alarthame has asked for the wisdom of the Perl Monks concerning the following question:
My Perl script:<html> <head></head> <body> <form action="/cgi-bin/hw4.pl" method="POST"> <br><br><br> <center><p>Please enter the following data:</p> <br> <table border=0><tr><td>First Name:</td> <td> <input type="text" name="first"></tr> <tr><td>Last Name:</td> <td> <input type="text" name="last"></tr> <tr><td>Age:</td> <td> <input type="text" name="age"></tr> <tr><td>Favorite Color:</td> <td> <input type="text" name="color"></tr> <tr> <td colspan=2><center><input type="submit"></center></td></tr> </table></center></form> </body> </html>
Update: I don't know if anyone will check this again, but I thought I'd comment to everyone here. Thanks to all of you for your comments. This is my first Perl assignment in this class, and for that matter, ever. I have updated my code to what suggestions that I received and what I realized I didn't do linearly. However, I still get the same errors, where that debugger says that most of my variables require an explicit package name. I'm sorry I assumed everyone would know that is what would happen. I don't really understand what that means, unfortunately. Update Again: After scouring the Perl help files, I found my bane, which actually happened to be the word "my." How come I never learned that I'd have to use that, in class? Seems like something awefully important to gloss over! Is a "my" statement usually necessary when declaring your own variables? Well, thanks again to all of you who have commented! ^_^ <--happy n00b#! /usr/local/bin/perl -w use strict; $buffer = $ENV{'QUERY_STRING'}; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $FORM{$name} = $value; } print "Content-type:text/html\n\n"; print "<html><body>"; print "<center>"; print "<h2>Your Data:</h2>\n"; foreach $name (keys(%FORM)) { print "$name = $FORM{$name}<br>"; } print "</center>"; print "</body></html>";
|
|---|