2009/8/12 Telemachus <telemac...@arpinum.org>: > 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.
Ah thanks, that's exactly what I was looking for. Philip -- "I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone." --Bjarne Stroustrup -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/