in reply to Load file into a scalar without File::Slurp
Or the semi-obfuscated version: as long as you just emptied out $/, why not use it? :)
{ local $/; $/ .= $_ while <STDIN>; }
P.S. In general, you want to make changes to global variables a temporary condition, as in merlyn's do loop above, and the more general form:
{ local $/; ## This is already undef, no need to set it ## Read in the file, etc... } ## $/ is now back where it was
|
---|
Replies are listed 'Best First'. | |
---|---|
(chromatic) RE: RE: Load file into a scalar without File::Slurp
by chromatic (Archbishop) on Jul 17, 2000 at 08:09 UTC |