# heres a snippet # @items contains all the thing i want to calculate frequency of. print "Items: @items\n"; # determine the frequency of each item. Sort them in ascending order. my %freq; my $count; foreach $pair (@items) { $freq{$pair}++; } # next foreach not working - want to print no of each individual item foreach $pair (@items) { ++$count; } my @array = sort { $freq{$b} <=> $freq{$a} } keys %freq; print "Sorted:@array\n"; print "Count:$count\n";