> -----Original Message-----
> From: Tim Musson [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 03, 2002 2:35 PM
> To: [EMAIL PROTECTED]
> Subject: How to get Multi-Line file into $var?
> 
> 
> hey Perl people!,
> 
>    Can't seem to get my brain to work this afternoon...
> 
>    I need to read a file and put it in a $Variable (not @Array).

{ local $/; $body = <FH> }

The "local $/" statement temporarily sets $/ to undef, which is called
"slurp" mode. This reads the whole file at once instead of line by line. $/
reverts to is previous setting when the closing brace is reached.

perldoc perlvar

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to