Or this
my $string = "abcabcacbabc";
my @num_count=($string =~ m/abc/g);
print scalar @num_count;
the advantage is that the array created contains 1's only where as the array created in your script contains search string which is longer (in the example you gave three times longer). The array gets trashed when out of scope but why thrash memory.
Lee.