in reply to Re: Common Perl Pitfalls
in thread Common Perl Pitfalls
First solution is not equal to last two, as it implies that INPUTFILE is already open. I would say that the correct idiom looks like this:
my $slurp = do { open my $fh, '<', "inputfile"; local $/; <$fh> };
P.S. I really like the second one, thanks. Not for production use, of course. :)
Regards,
Alex.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Common Perl Pitfalls
by JavaFan (Canon) on Apr 10, 2012 at 23:32 UTC | |
by dwalin (Monk) on Apr 10, 2012 at 23:50 UTC | |
by JavaFan (Canon) on Apr 10, 2012 at 23:57 UTC | |
by dwalin (Monk) on Apr 11, 2012 at 00:24 UTC | |
by JavaFan (Canon) on Apr 11, 2012 at 00:37 UTC |
In Section
Meditations