![]() |
|
Syntactic Confectionery Delight | |
PerlMonks |
Re^3: How to improve speed of reading big filesby bv (Friar) |
on Sep 18, 2009 at 13:46 UTC ( #796108=note: print w/replies, xml ) | Need Help?? |
From the pos documentation: pos directly accesses the location used by the regexp engine to store the offset, so assigning to pos will change that offset, and so will also influence the \G zero-width assertion in regular expressions. So if we know that we have fixed-width data and we only want to match "foo", "ding", or "widget" starting at the 10th character of the string, we can assign to pos($string) to set the "last matched position" to something other than 0, and then use the \G anchor (technically a zero-width assertion, like ^ and $) like so:
This code prints lines 1, 2, and 5
print pack("A25",pack("V*",map{1919242272+$_}(34481450,-49737472,6228,0,-285028276,6979,-1380265972)))
In Section
Seekers of Perl Wisdom
|
|