use URI; my %hostcount; while (<DATA>) { my $u = URI->new($_); $hostcount{$u->host}++; } foreach my $host (keys %hostcount) { print "$host = $hostcount{$host}\n"; } __DATA__ http://riverserver/dir1/dir2/index.html http://riverserver/dir1/dir2/index.html http://perlmonks.org/index.pl http://webserver.company.serv/Adir/Bdir/thePage.cfm http://riverserver/dir1/dir2/index.html http://webserver.company.serv/Adir/Bdir/thePage.cfm
Output:
webserver.company.serv = 2 riverserver = 3 perlmonks.org = 1
In reply to Re: Parsing to get server info
by ctilmes
in thread Parsing to get server info
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |