in reply to url get with string
If $name is just a simple string like you showed, with no special characters, then huck has given you the answer in regards to interpolation in '$name' vs. "$name".
However, if you've got any special characters in that string, they need to be escaped properly. Here's one way with URI:
use URI; my $name = 'xyz&foo=bar'; my $uri = URI->new('https://www.google.com/'); $uri->query_form( name => $name, foo => 'quz', ); print "$uri\n"; __END__ https://www.google.com/?name=xyz%26foo%3Dbar&foo=quz
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: url get with string
by bigup401 (Pilgrim) on Mar 23, 2017 at 10:36 UTC | |
by haukex (Archbishop) on Mar 23, 2017 at 10:46 UTC | |
by bigup401 (Pilgrim) on Mar 23, 2017 at 11:11 UTC | |
by huck (Prior) on Mar 23, 2017 at 12:43 UTC | |
by bigup401 (Pilgrim) on Mar 23, 2017 at 13:59 UTC |