Create a new $url object, passing it the unencoded url.
Then retrieve the encoded url with the $url->as_string(); method.
- Code: Select all
use URI::URL;
my $unencoded_url = 'http://www.this.com/script?a=1 this that&b=2';
my $url = URI::URL->new($unencoded_url);
print "encoded: " . $url->as_string . "\n";
