As is generally the case with perl, there are many ways to perform these tasks.my $digit_count = ($input =~ tr/[0-9]//); my $white_count; while ($input =~ m/\s/g) { $white_count++; } # note: can't use tr/\s// my $word_count; while ($input =~ m/\w+/g) { $word_count++; }
In reply to Re: Counting in regular expressions
by pc88mxer
in thread Counting in regular expressions
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |