Sample code for 30+ languages & platforms
Perl

URL Encoding and Decoding

Demonstrates URL encoding/decoding using the HTTP convenience methods.

Chilkat Perl Downloads

Chilkat2 Perl
use strict;
use warnings;
use Chilkat2;

my $http = Chilkat2::Http->new;

my $s = 'Hello World! 100% sure.';

my $encoded = $http->UrlEncode($s);
print 'URL encoded: ', $encoded, "\n";

# Space → %20
# ! → %21
# % → %25

my $decoded = $http->UrlDecode($encoded);
print 'URL decoded: ', $decoded, "\n";

# Output:

# URL encoded: Hello%20World%21%20100%25%20sure.
# URL decoded: Hello World! 100% sure.