in reply to Re: Need help with Piping
in thread Need help with Piping
If I just want the STDIN (or any file content) in a variable, and don't like to loop, I usually use this idiom:
my $var; SLURP: { local $/; $var= <>; }
local-izing $/ in a block undefines it and so no $var gets the whole filecontent sithout looping and reassembling it line by line.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Need help with Piping
by mscharrer (Hermit) on Aug 13, 2008 at 09:17 UTC | |
|
Re^3: Need help with Piping
by jasonk (Parson) on Aug 14, 2008 at 01:07 UTC |