Do you know where your variables are? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
It all comes down to the difference between and
Hugely slower? No. A quick benchmark here shows that the regular expression appoach is about twice as slow (and we are talking about a problem dominated by disk I/O anyway). One factor depends on how many naked IPs appear on a line. If there are several and only one interests you, the direct regexp will pick it up immediately, whereas the hash approach will have to test each one. Another consideration is that if you want to extend the approach to search for e.g. 192.168.0.* then you can no longer use the hash approach at all, since what gets matched does not correspond to any key. Or else I completely misread the question, in which case consider my solution withdrawn. - another intruder with the mooring in the heart of the Perl In reply to Re^3: Efficient Way to Parse a Large Log File with a Large Regex (with Regexp::Assemble)
by grinder
|
|