- Apply regex across a file:
while(<>) { m{ ^\S+ # Client host/IP \s\S+ # Identd user \s\S+ # HTTP auth user \s\[.*?\] # Date/timestamp \s"GET\s(/\S*)\s[^"]*" # URL path requested \s\d+ # HTTP status code \s\d+ # Bytes sent in body \s"\Q$site_root\E(/[^"]*)" # Referring URL path }x or next; $tally{ "$2 => $1" }++; }