my $str='dog dog dog dog dog'; #my $count4=()=$str=~m/dog/g; my $count5=()=$str=~m/dog/ for{1,3}; print "$count4 \n"; print "$count5 \n";