Well thats a very simple, neat and good for begginers script, (i like it)
so first, yes perl is a great language ver powerful, sicne it is not only web oriented, fast and with infinite number of add ons,
the $env,
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
# here the script check whether the form was submited via the POST or the GET actions. as you know the GET is the one that shows in the addres bar of your browser, and the POST dosent.
___ read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# now here read the info submited, STDIN ( i think is standard input, not sure) $buffer is where all the info will be stored, and $env, is like a perl action, somehow for sytem things, sing $ENV you can get the users ip, browser and lots of those things.
___ @pairs = split(/&/, $buffer);
# here you create the Array pairs, by spting the input [which looks like this (name=value&name2=value2&name3=value3) the & is a separator for each name and value. so after it is split the info will be stored in the arrary, it would look kind of like this.
@pairs = ('name=value', 'name2=value2', 'name3=value3');
___ foreach $pair (@pairs) {
______ ($name, $value) = split(/=/, $pair);
______ $value =~ tr/+/ /;
______ $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
___ $FORM{$name} = $value;
}
# and finally here using the foreach function, which is like a while, that end automatically, divide the name=value, into two different variables, the "=~" are the regex, the first one, changes the + signs with spaces, and the second one, not sure what it does, ill have to check that up.
then you just make a way to call the info, using the $FORM[$name] = $value,
for example if you have a name called "Shoe_size"
you use the print $FORM{Shoe_size} and it will print its value
Hope thats clear,
Calilo