if ($ENV{'QUERY_STRING'} ne '') { # for get requests $webparams = "$ENV{'QUERY_STRING'}"; } else { # for post requests (you should always use post) read(STDIN, $webparams, $ENV{'CONTENT_LENGTH'}); } $webparams =~ s/\&/\n/g; $_ = $webparams; %webparams2 = /^(.*?)=(.*)$/gm;