Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: Recursive file opening: reading an undef at the end of file

by thor (Priest)
on Dec 24, 2003 at 02:34 UTC ( #316772=note: print w/replies, xml ) Need Help??


in reply to Re: Recursive file opening: reading an undef at the end of file
in thread Recursive file opening: reading an undef at the end of file

it is a bad style not to close the files you opened
A few things:
  1. This was a quick and dirty script. Wrote it in about 5 minutes. Were this a production level script, I'd have done things differently.
  2. As I was using scalars ($fh) instead of barewords (FH), and I was lexically scoping them with 'my', the files are closed when the scalar goes out of scope. I tend to use features of the language when available.

thor

  • Comment on Re: Re: Recursive file opening: reading an undef at the end of file

Replies are listed 'Best First'.
Re: Re: Re: Recursive file opening: reading an undef at the end of file
by melora (Scribe) on Dec 24, 2003 at 14:44 UTC
    Point taken, it was quick and dirty. All the same, I consider it a good idea to have the habit of writing the close when you write the open. But then, too, I'm one of the those people that fastens the safety belt by habit, even if I'm going two blocks. So have a grain of salt with this post.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2021-12-08 18:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (36 votes). Check out past polls.

    Notices?