How about using a global match?
$ perl -e ' my @toCheck = qw{ A B }; my $string = q{2A 3B 4B}; foreach ( @toCheck ) { my $count = () = $string =~ m{$_}g; print qq{[$_]: $count }; } print qq{\n};' [A]: 1 [B]: 2 $
I hope this is useful.
Cheers,
JohnGG
In reply to Re: Simple Matching
by johngg
in thread Simple Matching
by rnroot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |