in reply to Count of array value into hash

Anonymous Monk Try this.

use strict; use warnings; use Tie::IxHash; my (%hash1); tie %hash1, "Tie::IxHash"; #To maintain the order my @array = ("one", "two", "one", "three", "four", "one", "two"); $hash1{$_}++ for (@array); my $hash = \%hash1; print "$_ => $hash->{$_}\n" for ( keys %{$hash}); #Dereference and pri +nt outputs: -------- one => 3 two => 2 three => 1 four => 1

I have used Tie::IxHash to maintain the insertion order, if order is not a matter, you can just ignore that. Also tak a look at hash and perlref.
shmem++

updated:

Prasad