in reply to Help on array element counting
And the output is -use Data::Dumper; @fruits = qw/ MANGO APPLE GRAPES MANGO MANGO MANGO MANGO APPLES APPLES BANANA CORN APPLES /; map { $count{$_}++ } @fruits; print Dumper(\%count);
$VAR1 = { 'GRAPES' => '1', 'CORN' => '1', 'APPLES' => '3', 'APPLE' => '1', 'BANANA' => '1', 'MANGO' => '5' };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Help on array element counting
by Hena (Friar) on Oct 28, 2003 at 07:44 UTC |