On Wed Aug 12 2009 @ 11:27, Philip Potter wrote:
> If $fh goes out of scope, will the file be automatically closed?
Yup. From perldoc perlopentut:
Another convenient behavior is that an indirect filehandle
automatically closes when it goes out of scope or when you undefine it:
sub firstline {
open( my $in, shift ) && return scalar <$in>;
# no close() required
}
See the whole section "Indirect Filehandles" for more.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/