1

リストを指定して、関数を複数回呼び出そうとするコードがあります。ループがあり、for()ループ内で関数を呼び出します。ただし、関数呼び出しの行で、奇妙なエラーが発生します。

[Thu Aug  8 08:31:37 2013] x.cgi: "my" variable $_ masks earlier declaration in same statement at /usr/home/x/public_html/cgi-bin/x.cgi line 310.
[Thu Aug  8 08:31:37 2013] x.cgi: "my" variable $_ masks earlier declaration in same statement at /usr/home/x/public_html/cgi-bin/x.cgi line 310.

行に a がまったく含まれていないため、エラーは奇妙ですmy

これが私のコードで、perl 5 で実行します。

sub cgiPrintForm {
    my $fh = shift;
    for (qw!betatest subscribe fname lname position department company address1 address2 city province postalcode country phone fax email hearofus comments!)
    {
      print $fh "\n$_: ",param($_) if defined(param($_));
    }
    print $fh
      "\nReferer: ",referer(),
      "\nRemote Host: ",remote_host(),
      "\nRemote IP: ",remote_addr(),
      "\nRemote Ident: ",remote_ident(),
      "\nUser Agent: ",user_agent(),"\n";
}

明らかに、Perl の魔法の一部がうまくいかず、自動化myが私を台無しにしています。

4

1 に答える 1