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: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/