antirice and aquarium have answered the immediate question, as to why the code at line 23 generated that particular error. If you follow their advice and simply put  my %in; above that offending line, I can anticipate what your next posted question might be...

"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:

$body .= param($_)."\n" for @param;
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.

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:

$body .= join("", "$_ : ", param($_), "\n") for @param;
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:
for my $p (@param) { my @v = param( $p ); $body .= join( "", map { "$p : $_\n" } @v ); }

In reply to Re: Global symbol requires explicit package name by graff
in thread Global symbol requires explicit package name by Nickd_69

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.