in reply to Re: grepping for
in thread grepping for

index(), in turn, may be a little faster than substr(). And replacing the regex on the error code should help, too. [code removed to protect the innocent] Update:

index() is faster when the match occurs at the beginning of the string, but substr() is much better when there is no match at all, which happens quite a lot in this application.

$dir = "/$dir/"; my $strlen = length $dir; while (<LOG>) { my ($url, $code) = (split)[6,8]; if (substr($url, 0, $strlen) eq $dir && $code == $error) { $report{$url}++; } }