Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Search Efficiencyby Cirollo (Friar) |
on Jul 11, 2001 at 19:00 UTC ( [id://95708]=note: print w/replies, xml ) | Need Help?? |
Perl doesn't read in the entire file each time through that loop. Each time through the loop, Perl just reads the next line from the still-opened file.
A few tidbits that might come in handy if you're doing anything more complex: If you need to know the current line number, look at the $. variable (dollar dot). The seek function can be used to go to a specific part of a file without reading the whole thing. The tell function returns the current file position in bytes, based at 0.
In Section
Seekers of Perl Wisdom
|
|