in reply to FileHandle: undef vs close
I'd say they do equivalent things. When a file handle has goes out of scope (or has no more references to it), it is automatically closed. undefing it will drop its refcount to zero, which is why it automatically closes.
I believe you would see the same behavior if you had done a simple open my $fh, "r".
At any rate, they aren't identical, but the outcome is the same. I would recommend using close, but only because I think its intent is more clear.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: FileHandle: undef vs close
by Utilitarian (Vicar) on Apr 30, 2009 at 15:20 UTC | |
by chromatic (Archbishop) on Apr 30, 2009 at 17:59 UTC | |
|
Re^2: FileHandle: undef vs close
by vinoth.ree (Monsignor) on Apr 30, 2009 at 14:31 UTC |