Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Help need in Miscellaneous code

by ikegami (Patriarch)
on Apr 12, 2006 at 04:43 UTC ( [id://542747]=note: print w/replies, xml ) Need Help??


in reply to Help need in Miscellaneous code

  • $_ is aliased to $x by the foreach loop,
  • while does not localize $_ (like foreach loops do), and
  • while (<FH>) assigns to $_.

Fix:

sub readZip { local $_; open local *FH, '/dev/null'; while (<FH>) { print "Got something!\n"; } }

I localized FH as well.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://542747]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-20 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found