in reply to Help on array element counting

Here is a simple yet explanatory (I hope) way of doing it:
#!/usr/bin/perl -w use strict; use warnings; use diagnostics; my @array = qw(MANGO APPLE GRAPES MANGO MANGO MANGO MANGO APPLES APPLE +S BANANA CORN APPLES); my %hash; foreach (@array) { $hash{$_}++; } for my $key(keys %hash) { print "$key => $hash{$key}\n"; }