P is for Practical | |
PerlMonks |
Re: Re: Why use <$fh> at all?by cluka (Sexton) |
on Oct 05, 2002 at 20:48 UTC ( [id://203083]=note: print w/replies, xml ) | Need Help?? |
Excellent points! Several people have pointed out very egregious
logic errors in the initial code. Several of them are not
errors in the sense that I know the specifics of the files I
am using (no blank lines, no '\n' at the end of the file).
I really like blogans comment. Does <$fh> hit the disk each time, or is it reading from a cached block? Does anyone know? I guess my initial point was flawed for the general case, but I can reformulate it to a better, stronger statement: If you know certain aspects of the files you are reading (e.g. average line size, whether there are blanks in the file, etc) you could implement a bare-bones, lightning-fast read method that passes up the traditional <$fh>. But for a basic, system-independent file-reader, <$fh> is a strong contender. Anyone agree?
In Section
Seekers of Perl Wisdom
|
|