in reply to Pattern match location finding

or something like (untested):
my $ind = -1; while (($ind = index($string, $substring, $ind+1) >= 0) { push @offsets, $ind }
Update: add missing (