|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|
Re: Quick question: how to slurp a file?
|
On Wed, May 02, 2001 at 01:48:11PM -0400, Susan J. Talbutt wrote:
> We're beating our heads against a wall here. The office mate swears perl
> has a way to read in an entire file in one gulp (as opposed to the more
> familiar <> operator).
>
> Can anyone confirm or deny?
What do you mean "as opposed to"? I would use <> to read in an entire file
in one go.
my $text = do {local $/; <>};
Or if you have the file name in some scalar $file:
my $text = do {local (@ARGV, $/) = $file; <ARGV>};
Abigail
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**
|
|