> It sounds like you need a count hash. You might try something like:
>
> my @tokens = split /:/;
> foreach (@tokens) {
> if ($tokenCount{$_}) {
> $tokenCount{$_}++;
> } else {
> $tokenCount{$_} = 1;
> }
> }
The following works the same and may or may not be easier to
understand/maintain.
$tokenCount{$_} is automatically created with a value of 0 when first
called, and
then is incremented to 1, so you don't have to test or create it yourself.
my @tokens = split /:/;
for (@tokens) {
$tokenCount{$_}++
} # for
>My test run using this approach got the listing below per line of your
data:
You should get the same counts this way.
You can then either loop through an array/list of all possible phenomes if
you
want to print 0 values as well, or just "for (keys %tokenCount) {print}" if
you
only want to see counts on ones that exist.
/\/\ark
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]