in reply to search one instance

I don't quite understand how we get from toniax's OP to finding all starting positions of the substring, but here's another way:

>perl -wMstrict -le "my $str = qq{foo data } x 5; print $str; ;; print qq{start of 'data' at $-[1]} while $str =~ m{ (data) }xmsg; " foo data foo data foo data foo data foo data start of 'data' at 4 start of 'data' at 13 start of 'data' at 22 start of 'data' at 31 start of 'data' at 40

See @- (and its cousin @+) in perlvar.