in reply to pulling by regex
$log_line =~ s/"GET.*"h/ /;
One thing that I would advise is that instead of stripping everything around what you want, that you take some time to look over perlre so you get a little better grasp at the regular expressions and get what you want out of the lines instead. For instance, you are over using the dot star a lot, in most cases you would be better off putting a ? after the dot star so that it does not match all the way to end and then backtrack until it finds a match.
Anyhow, I might do something like the following inside the for loop:
foreach my $log_line(@log_data) { my ($date_string,$referrer) = ($log_line =~ /\[([^\]]+)\] "[^"]+"[^" +]+"([^"]+)"/); print "$date_string,$referrer<P>\n"; }
Which as I mentioned gets what I want and nothing else. ( I am making some assumptions about the rest of your data, but based on what you have it should work).
</rant>you should be using strict as well</rant>
-enlil
|
|---|