#!c:\perl\bin\perl.exe read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'}); @pairs = split(/&/,$buffer); foreach $pair (@pairs) { ($key,$value) = split(/=/,$pair); $key =~ tr/+/ /; $key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; $value =~ s///g; $formdata{$key} = $value; } print "Content-type:text/html\n\n"; print "
Sample2.cgi
"; print "
POST Method
Keys:
Values:"; foreach $key (keys %formdata) { print "
$key
$formdata{$key}"; } print
";