Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This is my first project in Perl, so be kind.
I have constructed a URL which contains a URL as the value to a query parameter. So, some ampersands need to be treated as ampersands separating query parameters, but others need to be changed so they aren't interpreted as separating query parameters.
Here's an example:
my $url_parm = 'http://www.whatzit.com?a=1&b=2'; $url =~ s/&/&/sg; my $url = "http:/www.xyzzy.com?url=$url";
Can someone point out the error of my ways?
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: encoding URL ampersands?
by kennethk (Abbot) on Jul 29, 2010 at 19:49 UTC | |
|
Re: encoding URL ampersands?
by eff_i_g (Curate) on Jul 29, 2010 at 19:39 UTC | |
|
Re: encoding URL ampersands?
by ikegami (Patriarch) on Jul 29, 2010 at 20:16 UTC | |
|
Re: encoding URL ampersands?
by almut (Canon) on Jul 29, 2010 at 19:49 UTC | |
|
Re: encoding URL ampersands?
by aquarium (Curate) on Jul 30, 2010 at 02:05 UTC | |
|
Re: encoding URL ampersands?
by locked_user sundialsvc4 (Abbot) on Jul 30, 2010 at 00:08 UTC |