in reply to Load file into a scalar without File::Slurp
or use an in-line block:$contents=slurp('foobar'); sub slurp {local$/=<>if local@ARGV=@_}
or, if you could afford a filehandle and wasted CPU time:{local$/;$contents=<>if local@ARGV='foobar'};
Of course, if this is really a Perl Golf contest entry, I'll probably write:$contents=join'',<_>if open _,'foobar';
But it's platform dependent and cheating, so don't do that. :-p$contents=`cat foobar`
/Autrijus/
|
|---|