http://www.perlmonks.org?node_id=292505


in reply to Elegant (i.e. declarative) way to find all possibly overlapping matches

Why bother with the while loop?
my $str= "aaa aa aaa"; print "String = '$str'\n"; () = $str =~ /(?=aa)(?{print pos($str),"\n"})./g; __END__ String = 'aaa aa aaa' 0 1 4 7 8

--

flounder