Hello fellow monks
Will the file handle in this sub be closed automatically or is it accidentally left open? To the best of my knowledge it will be closed due to going out of scope but I'd like to confirm this.
sub slurp_file { my $file = shift; open my $fh, '+<', $file or croak("E: Unable to open file '$file': $!"); local $/; return <$fh>; }
(I know about File::Slurp, this code is just an example.)
In reply to Scoping question - will file handle be closed? by Monk::Thomas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |