[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Read entire file?



On 12:25 PM 12/27/00 Dan Baker <dan@dtbakerprojects.com> wrote:

> Jim Correia wrote:
> > 
> > So I'm a c programmer, and my perl book is at the office.
> ----------
> your perl documentation is also available on the machine perl is
> installed on....

Yes, but having forgotten about the -s test made it difficult to find
with shuck.

> > 
> > What is the best (fastest, clearest code) to read an entire file
into a
> > variable?  
> -----------
> 
> open( HANDLE , "<$RelativeFilePath" ) or die "failed to open
> $RelativeFilePath because $!";
> @WholeFile = (<HANDLE>);

This is specifially what I was trying to avoid.  I wanted a scaler so
why pay for the overhead of conversion to a list then back again.  And
then there is the issue of non-native line endings...

Jim

-- 
Jim Correia                                Bare Bones Software, Inc.
correia@barebones.com                     <http://web.barebones.com>

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org