|Think about Loose Coupling|
print log fileby xiaoyafeng (Chaplain)
|on Nov 30, 2006 at 04:08 UTC||Need Help??|
xiaoyafeng has asked for the
wisdom of the Perl Monks concerning the following question:
I wonder that's a simple question,but i can't find a better way.I have a log file as below:
Now, I need to print all description after some timestamp.
below is my code:
my question: I don't wanna compare timestamp every loop,because log file is sorted by timestamp.That is,if one timestamp is greater than threshold, print the rest of all (no comparison). How can do that?
all reply would be appreciated!
Thanks for your help to let me know my stupidity!In fact,my question is:
how traverse a large sorted(indexed) file faster?
According to your reply,I have three way to do it:
1. flipflop operator
2. binary seek
3. Tie::File (array)
which one is the best? I think nobody but benchmark module could answer it. :-)