http://qs321.pair.com?node_id=446553

ambs has asked for the wisdom of the Perl Monks concerning the following question:

I need to pass as parameter for a script a complete URL. This URL can itself be an URL for a script. So, I need to quote special characters like '&' and '?'.

Is there any module to quote special characters on URIs? Like the standard s/ /%20/ one?

Thanks in advance.

Alberto Simões

Replies are listed 'Best First'.
Re: Quoting URIs
by ambs (Pilgrim) on Apr 11, 2005 at 10:37 UTC
Re: Quoting URIs
by Jenda (Abbot) on Apr 11, 2005 at 11:56 UTC

    There's also CGI::Enurl

    Jenda
    We'd like to help you learn to help yourself
    Look around you, all you see are sympathetic eyes
    Stroll around the grounds until you feel at home
       -- P. Simon in Mrs. Robinson

Re: Quoting URIs
by ambrus (Abbot) on Apr 11, 2005 at 20:00 UTC

    Yes, it's CGI.

    perl -we 'use CGI; print CGI::escape("hello, world\n"), $/'
    ==>
    hello%2C%20world%0A