in reply to Re: Performing a tail(1) in Perl (reading the last N lines of a file)
in thread Performing a tail(1) in Perl (reading the last N lines of a file)
Tie::File ... Pretty much as simple as it gets. Unfortunatly, it's not quite so hot on the performance:Not too surprising, because unlike most of the methods you benchmarked, Tie::File does not read the file backwards. It reads it forwards, starting at the beginning, and constructs some data structures along the way. For a long file like /var/adm/messages, this will take some time, because it grovels over the entire file.
The payoff would come if you then asked it to tell you what was on line 12,345, which it would do instantly---or if you asked it to modify line 12,345, which the other modules won't do at all.
--
Mark Dominus
Perl Paraphernalia
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Performing a tail(1) in Perl (reading the last N lines of a file)
by Anonymous Monk on Oct 23, 2002 at 20:06 UTC |