I get better performance with this:
my $parse_log_entry = qr/^$dateRegex/ms;
...
my $prevpos = 0;
while( $logfile =~ m/$parse_log_entry/g ) {
$count++; # count number of parsed strings
if ($prevpos) {
# print "Do something with $prevpos .. $-[0]\n";
# print substr($logfile, $prevpos, $-[0]-$prevpos), "\n";
}
$prevpos = $-[0];
}
You would use the substr expression above to access what you're currently capturing, though you don't indicate that what you're capturing is actually used at all. .
Caution: Contents may have been coded under pressure.