http://qs1969.pair.com?node_id=1217182

haukex has asked for the wisdom of the Perl Monks concerning the following question:

I sometimes use (and suggest) this to slurp a file in a single line:

my $data = do { open my $fh, '<', $file or die $!; local $/; <$fh> };

The lexical filehandle should be automatically closed at the end of the block. Can anyone think of any downsides to the above? Like perhaps some subtle scoping issue, or it's bad style to rely on the implicit close, etc. ... or am I just being paranoid?

Update: Typo fix, $/ not $\, thanks Corion!