in reply to Beware of global! And bless the local!

Here's a neat little idiom:

my $key_string = do { use warnings qw(FATAL); local(@ARGV,$/) = ($file +); <> };

Replies are listed 'Best First'.
Re^2: Beware of global! And bless the local!
by haukex (Archbishop) on Dec 12, 2019 at 20:37 UTC
    use warnings qw(FATAL);

    Note that requires Perl 5.20 and up, in earlier versions it's use warnings FATAL => 'all'; (<brag> I know cause I wrote the patch, my first in the Perl core ;-) </brag>)