in reply to count string occurance
#!/usr/bin/perl @array = ( "Hm54", "Dh60", "Dh60", "Be45", "Be45", "Be45" ); my (%count); $count{$_}++ foreach @array; print $_, " -> ", $count{$_}, "\n" foreach keys %count; exit 0;
Be45 -> 3 Dh60 -> 2 Hm54 -> 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: count string occurance
by softworkz (Monk) on Jul 27, 2001 at 22:43 UTC | |
by PrakashK (Pilgrim) on Jul 27, 2001 at 22:58 UTC | |
by softworkz (Monk) on Aug 01, 2001 at 17:11 UTC |