rhxk,
Your original title was misleading, but has been edited. You want the total number of
X in all the elements of a list. This sub should give you an idea of how to make it general. Since others have complained about not making an effort or possibly being homework, I have obfu'd it a bit.
sub Count {
my $t;
for ( @_[1..$#_] ) { ($t) += grep {$_ eq $_[0] } split // }
return $t;
}
Cheers - L~R
Update Modified to reflect title change by
editors