> Message du 06/10/08 17:03
> De : "[EMAIL PROTECTED]"
> A : beginners@perl.org
> Copie à :
> Objet : data from file
>
>
> Hi,
>
> I have large file in following format:
>
> ID | Time | IP | Code
>
>
> Now I want to write script that will cluster data by IP addr. and
> count total number of IDs for corresponding IP.
>

first I hope this is not a homework question.
you may try something like:

my $hash = {};
while(<DATA>) {
    my ($id,$ip) = (split)[0,2];
    $hash->{$ip}->{$id} ++;
}

use Data::Dumper;
print Dumper $hash;


Regards,
Jeff.

 Créez votre adresse électronique [EMAIL PROTECTED] 
 1 Go d'espace de stockage, anti-spam et anti-virus intégrés.

Reply via email to