#!/perl5/bin/perl.exe #!/usr/bin/perl # Order the lines above so that the first gives the location # of Perl on your system. The rest become comments. #simple Perl script to echo a FORM's input print "Content-type: text/html\n\n"; #note: GET is case sensitive if ($ENV{'REQUEST_METHOD'} eq "GET") {$buffer = $ENV{'QUERY_STRING'};} else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } print "\n"; print "Query Results\n"; print "\n"; print "Query Results\n"; print "
\n";

@nvpairs = split(/&/, $buffer);
foreach $pair (@nvpairs)
{
	($name, $value) = split(/=/, $pair);
# Replace "+" by " " and undo hexidecimal encodings
#       $value =~ tr/+/ /;
#       $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

	print "$name = $value\n";
}
print "
\n"; print "\n";