>
>
> could some one throw some light on how i can do this.
> thanks in advance..
>

use strict;
use warnings;

my @array = (1,2,3,4,2,3,1,2,1,1,1,4,6,7);
my %hash;
foreach my $item (@array){
    if (exists $hash{$item}) {
        $hash{$item} = $hash{$item} + 1;
    } else {
        $hash{$item} = 1;
    }
}

print "@array\n";
while(my ($key,$val) = each %hash) {
    print "$key => $val\n";
}

~Parag

Reply via email to