in reply to Opening files in a loop
The advantage of lexicals is that you can use the same file handle (locally scoped) inside nested calls of a sub without collisions, and you can easily store the handle inside a data structure and retrieve it later.my $handle; open ($handle, $filename); ... close ($handle);
Re: Three arguments for open vs two - is this really a major concern if you control all file paths yourself? Seems to me that you only really need to worry if the path contains user input, in which case tainting / parsing should do the trick. Can you explain how someone could do damage by accident rather than on purpose?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Opening files in a loop
by chromatic (Archbishop) on Jun 04, 2005 at 05:53 UTC |