print $-[0], "\n" while $str1 =~ /\Q$str2\E/g; # using a regex