in reply to count subset of chars in a line
There's a very pretty way to count them with the tr// operator, my $vowel_count = tr/AEIOUYaeiouy//; If you want the character list in a variable, you need to string-eval: my $foo_count = eval "tr/$foo//";
After Compline,
Zaxo
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: count subset of chars in a line
by GrandFather (Saint) on Jun 22, 2005 at 04:01 UTC |