in reply to Global symbol requires explicit package name
"Why do I get these warnings about 'use of undefined value at line 24'?" The uncooperative answer will be: "You added that extra line to declare %in, so the for-loop line is now line 24, and you are using the '-w' flag on the initial line of the script, which causes these warnings to be printed to stderr, and you have not assigned any values to the hash array %in, which is what those warnings are complaining about."
So, the next issue for you to address is: what is the hash array %in supposed to contain? Where are these contents supposed to come from? It seems that you expect this hash to have elements keyed by the various strings in the @param array, and since you are using the CGI module, you probably want %in to hold the names and values of parameters that come in from a web form, but you haven't got the code that is needed to put those values into %in.
The man page for the CGI module is very informative -- it's long, but it's worth the time you take to read it. That should make things clearer for you. Look especially at the part titled "FETCHING THE VALUE OR VALUES OF A SINGLE NAMED PARAMETER".
In your case, it might be best to ignore what the earlier replies suggested, and base your code on a better knowledge of the CGI module. In essence, you don't need a hash array:
This uses the "function-oriented" style of CGI usage, calling the "param()" method to return the value of each parameter name, as supplied by the @param array.$body .= param($_)."\n" for @param;
update: personally, if I were expecting email from this sort of process, I would prefer that the email message include the parameter name on each line along with the parameter value:
and of course, if any parameter name could be submitted with more than one value, I'd want the email to list all of the values, which could be done like this:$body .= join("", "$_ : ", param($_), "\n") for @param;
for my $p (@param) { my @v = param( $p ); $body .= join( "", map { "$p : $_\n" } @v ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Global symbol requires explicit package name
by Nickd_69 (Novice) on Aug 15, 2003 at 02:31 UTC | |
by graff (Chancellor) on Aug 15, 2003 at 02:40 UTC | |
by chromatic (Archbishop) on Aug 15, 2003 at 03:00 UTC | |
by graff (Chancellor) on Aug 15, 2003 at 03:11 UTC | |
by rinceWind (Monsignor) on Aug 15, 2003 at 11:26 UTC | |
by Nickd_69 (Novice) on Aug 15, 2003 at 02:59 UTC |