Hi all,

I have file like that following,

site_name                 access_time
www.google.com            14:13:04|14:13:04|
172.16.5.49               14:12:10|14:12:56|
172.16.65.53               14:12:41|14:12:58|
172.16.671.35               14:12:29|

from the above file i need to print the sites & no of accessed
connections with sort. 


open(FILE,:/tmp/test.txt/" or die "cant open the file");

my  @domain_info=<FILE>;
        foreach my $site (@domain_info)
        {
              my   ($domain,$data)=split(" ",$site);
                $domain{$domain}.=$data;
        }

foreach my $dname ( keys %domain)
{
        my @conn=split('\|',$domain{$dname});
        my $noofconn=$#conn+1;
        $noofconns{$dname}+=$noofconn;

}
foreach $dname (sort {$noofconns{$b} <=> $noofconns{$a}} %noofconns)
{
   print "$domain\n";
   print "$noofconns\n";
}
close (<FILE>);

Could u help me to solve the pbm???

Thanks,
Siva

Reply via email to