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

Re: [MacPerl] Read entire file?



On Wed, Dec 27, 2000 at 11:00:48AM -0500, Jim Correia wrote:
> So I'm a c programmer, and my perl book is at the office.
> 
> What is the best (fastest, clearest code) to read an entire file into a
> variable?  I want to preserve whatever line endings were in the original
> file so I don't want to read it by lines.  Right now I am reading by
> chunks because I can't seem to find a function that will return the size
> in bytes of the file on disk...

The -s filetest operator returns the size of the file.  I think Win32 is
actually the only platform that changes the line endings, though.

Ronald

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