Re: Tie::File surprise (to me)



"b" == boyd <tbmoore9@xxxxxxxxxxx> writes:

b> I probably should have known this, but didn't. In Tie::File, where you
b> tie an array to a long file, and you want to read backwards from the end
b> of it ( to look for the most recent lines, for example, in a log file),
b> it is much faster to address the lines with $index as a negative number,
b> meaning to search from the end of the array. It takes a while for the
b> module to find the index = -1, but the subsequent searches on -2, -3,
b> etc. are much faster than using @#array-1, @#array-2, etc.

you should use File::ReadBackwards for that. much faster than tying a
log file.

uri

--
Uri Guttman ------ uri@xxxxxxxxxxxxxxx -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
.



Relevant Pages

  • Re: Tie::File surprise (to me)
    ... tie an array to a long file, and you want to read backwards from the end ... meaning to search from the end of the array. ... The times I got were on a log file of 30000 lines or so: ...
    (comp.lang.perl.modules)
  • Tie::File surprise (to me)
    ... tie an array to a long file, and you want to read backwards from the end ... meaning to search from the end of the array. ... The times I got were on a log file of 30000 lines or so: ...
    (comp.lang.perl.modules)
  • Re: Tie::File surprise (to me)
    ... Uri Guttman wrote: ... b> tie an array to a long file, and you want to read backwards from the end ... b> of it (to look for the most recent lines, for example, in a log file), ... b> meaning to search from the end of the array. ...
    (comp.lang.perl.modules)
  • Re: regExp
    ... > It uses ReadAllto store the entire log file into an array then it uses ... ReadAll() is not suitable for "find" style log parsing because it's ... Of course if it's just a script for Juan to run himself, ...
    (microsoft.public.scripting.wsh)
  • tcllib tie package issue with remotearray datasource
    ... A previous post wanted an easy way to update an array to/from a server ... thought of using the tcllib tie library as it had a remotearray data ... global av forever ...
    (comp.lang.tcl)