You can fill the array in one step using qw, and you can count all 'b' in this array in one step using grep:
my @ar = qw /a b b a/; my $cnt = 0 ; $cnt = grep /b/, @ar;
In reply to Re: problem with foreach
by neniro
in thread problem with foreach
by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |