open(FILE, "your.log"); # read each line from the file while ($line = ) { if ($line =~ m/the pattern you're looking for/) { # do something with the matched line } }