#!/usr/bin/perl # A start of an implementation of the reporting script in project 5 # # Last revised 4/2/07 by Brian D. Davison # $filename = "/home/brian/cse271/january-access.log"; open FILE, $filename; # read through the file just once, line by line while () { $line = $_; chop $line; ($ip, $i1, $i2, $d1, $d2, $get, $url, $method, $code, $size, $refer, @rest) = split(' ', $line); $client = join(' ', @rest); # put the client string back together $count++; if ($url eq "/robots.txt") { $robotname{$client} = 1; # track robot client strings and $robotip{$ip} = 1; # ip addresses for later use } } print "$count lines processed.\n";