in reply to search for a sequence of chars in a string

To find an exact match of a string, index is preferred.

my ($here, @places) = 0; while (($here = index $string, $search, $here) != -1) { push @places, $here++; } printf "String %s occured %d times\n\n", $search, scalar @places;

After Compline,
Zaxo