Not sure why, but only the last name/value pair are placed in the hash. for example, the form had 3 inputs. name, age, and word (for testing purposes..heh). upon submitting the form to the script with the values .cgi?Name=my+name&Age=12&Word=xyzzy ...checking the values in the scalar & the array, things come out fine. when checking the values in the hash, i only get... Word: xyzzy ...which would be the last things in the query string. Why this comes out this way I do not know. Maybe some else does? Like I said... Only been workign with Perl for a few weeks, and please excuse how verbose this is.print("Content-Type: text/html\n\n"); print("<HTML><BODY>"); $QSTRING = $ENV{'QUERY_STRING'}; $QSTRING =~ s/\+/ /g; print("<P align=center><B>(\$)QSTRING</B>: $QSTRING</P>"); # Split the $QSTRING by the ampersand and assign the parts to @QSTRING @QSTRING = split(/&/,$QSTRING); # Check the values in @QSTRING print("<P align=center><B>(@)QSTRING</B>:"); foreach $QSPart(@QSTRING) { print(" $QSPart"); } print("</P>"); foreach $Part(@QSTRING) { %FormData = split(/=/, $Part); } # Attempt to print out the names and values of the QSTRING.... @InputNames = keys(%FormData); foreach $InputName(@InputNames) { print("<P align=center><B>$InputName</B>: $FormData{$InputName}</P +>"); } print("</BODY></HTML>");
In reply to A Beginner Apparently Sucks With Hashes... by relayeddeaction
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |