http://www.perlmonks.org?node_id=479229


in reply to Re: getfile( $filename )
in thread getfile( $filename )

Yeah, I've run across that little ditty before, most recently as a yak shaving on my IPC::Open3 journey, but it doesn't handle wantarray. It just occurred to me that it doesn't chomp the lines either ... hmmm ...
return wantarray ? do { my @lines = <$FH> ; chomp @lines ; @lines } : do { local $/ ; <$FH> };
I wish there was a way to chomp <$FH>.
Harley J Pig