The answer getting printed is 6!!! but the answer should be 1. (or 2 if I can make tr/// ignore the case).use warnings; use strict; my $str = "The quick brown fox jumps over the lazy dog"; my $count = ($str =~ tr/(the)//); print "$count\n";
In reply to counting the number of occurrances of a word using regex by abhishes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |