#!/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
In reply to Re: count string occurance
by rob_au
in thread count string occurance
by softworkz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |