variables - Why is perl complaining about a "my" when the line does not have one? -
i have code tries call function multiple times, given list. have for() loop, , inside loop call function. on line function call, strange error:
[thu aug 8 08:31:37 2013] x.cgi: "my" variable $_ masks earlier declaration in same statement @ /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 @ /usr/home/x/public_html/cgi-bin/x.cgi line 310. the error strange because line not have my in @ all.
here's code, run perl 5.
sub cgiprintform { $fh = shift; (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"; } obviously of perl's magic has gone wrong , automatic my messing me up.
your example code not have 310 lines don't show code. it's not possible find error in code snippet not contain it. please show code or @ least minimal example shows same behavior. see http://shadow.cat/blog/matt-s-trout/show-us-the-whole-code/ more details.
Comments
Post a Comment