$line = '127.0.0.1 - - [26/Mar/2001:16:01:07 -0500] "GET /stuff/ HTTP/1.0" 200 11874' #### use strict; my ($ip,$date,$method,$file,$header,$status,$pid) = $line =~ /^([\d.]+) # $id = ip quad \s*-\s*-\s* # skip over these \[(.*?)\]\s" # $date = everything between the brackets (\w+)\s* # $method = the method, usually GET or POST ([^\s]+)\s* # $file = everything UP TO the next white space (.*)"\s* # $header = everything UP TO the next double quote (\d+)\s* # $status = digits between spaces (\d+)\s*$/x; # $pid = last set of digits print "$ip\n$date\n$method\n$file\n$status\n$pid\n";