sub getquery{ my $method = $ENV{'REQUEST_METHOD'}; my $query_string, $pair; my %query_hash; $query_string = $ENV{'QUERY_STRING'} if $method eq 'GET'; $query_string = <STDIN> if $method eq 'POST'; return undef unless $query_string; foreach $pair (split(/&/, $query_string)) { $pair =~ s/\+/ /g; $pair =~ s/%([\da-f]{2})/pack('c',hex($1))/ieg; ($_qsname, $_qsvalue) = split(/=/, $pair); $query_hash{$_qsname} = $_qsvalue; } return %query_hash; }