On 27.12.00 at 11:00, Jim Correia <correia@barebones.com> wrote: >So I'm a c programmer, and my perl book is at the office. Shame on you! You must immediately convert all your code to Perl and write "C Sucks!" one hujdred times, and two Hail Marys, as penance. :-) >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... Whats wrong with "$file = <FH>"? See <URL:http://www.perlmonks.org/index.pl?node_id=1953&lastnode_id=1952> and "perldoc perlvar" in the section on "$/" (aka. "$INPUT_RECORD_SEPARATOR" aka. "$RS" (in "use English", obviously)). There may be something special about files in the context of MacPerl, but on UN*X I'd use stat() or the File::Stat module (that is perhaps a Perl 5.6-ism?), and I expect the MacPerl docs will cover any differences. # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org