Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Cleaning up a text file with compact regex

by betterworld (Curate)
on Apr 24, 2007 at 09:49 UTC ( #611675=note: print w/replies, xml ) Need Help??


in reply to Re: Cleaning up a text file with compact regex
in thread Cleaning up a text file with compact regex

while (<$fh>)

You should always put local($_); before such a loop, because the global variable $_ is set to each line and is not cleaned up in the end.

Update: http://perl.plover.com/local.html has an example of the dangers of this kind of while loop.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2021-07-31 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?