in reply to A Few Questions About IO::File
I get how $fh->close fits your brain better, but you can also consider that the file handle will be closed when the variable holding the filehandle goes out of scope.
So you could do something like this:
My background is C, so I usually follow an open command with a close command, then go back up and do everything else, but you can use a block to effect the same thing.use IO::File; { my $fh = IO::File->new('foo', 'r'); # do something with $fh } # The file handle has been automagically closed!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A Few Questions About IO::File
by rpetrelli (Novice) on Mar 18, 2013 at 15:13 UTC |