use CGI;
my $cgi = CGI::->new();
my %FORM = $cgi->Vars();
instead of
read(STDIN, $input, $ENV{'CONTENT_LENGTH'});
# split the input
@pairs = split(/&/, $input);
# split the name/value pairs
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ 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/<([^>]|\n)*>//g;
$FORM{$name} = $value;
}
because it is much more flexible and secure. What happens with your code if there are multiple checkboxes with the same name? What if a value contains the char = ?
If you worry about the overhead of loading the CGI-Module: most often it doesn't matter at all. If it mattered, you could use CGI_Lite instead.
Btw: is it possible for you to directly work with the hash %FORM instead of converting everything to a scalar variable?
Best regards,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32" |