/home/wpollock1/public_html/restricted/ShellScripting/urldecode
#!/usr/bin/perl
#
# urldecode - decodes URL encoded text from stdin and prints to stdout
#
# Written 6/2003 by Wayne Pollock, Tampa Florida USA.
# Read the input into $_ buffer:
while ( <> )
{
# Split $_ into an array of NAME=VALUE pairs:
split( /&/ );
# Process each pair by decoding the URL-encoded VALUE:
foreach ( @_ )
{
($name, $val) = split( /=/ );
# URL decoding:
$val =~ tr/+/ /;
$val =~ s/%([a-fA-f0-9][a-fA-f0-9])/pack("C",hex($1))/eg;
print "$name = $val\n";
}
}