All pastes #827410 Raw Edit

Mine

public text v1 · immutable
#827410 ·published 2007-12-21 19:20 UTC
rendered paste body
while ($log_line = <STDIN>) {
    my @temp = split (/\"/, $log_line);
    ($vhost) = $temp[4];
    $vhost =~ s/ //g;

202.7.166.171 - "" [29/May/2007:18:43:02 -0700] "GET /favicon.ico HTTP/1.0" 401 
6003 "-" members.birdwatchers.com "Avant Browser" 21083

For lines like these, this code is setting vhost as "4016003", not "members.birdwatchers.com".  Is there a way to make it work for both lines of this format and normal lines like:

68.219.225.240 - - [29/May/2007:17:17:04 -0700] "GET /s1/images/hmd-table_03.jpg
 HTTP/1.1" 200 27758 "http://www.birdwatchers.com/s1/index.html?revid=49635&re
fer=http%3A%2F%2Fwww.ferretslovers.com%2Fmuscle" www.birdwatchers.com "Mozilla/4.0
 (compatible; MSIE 6.0; Windows NT 5.1; SV1; FunWebProducts; .NET CLR 1.0.3705; 
.NET CLR 1.1.4322; Media Center PC 3.1)" 19977