RosettaCodeData/Task/String-matching/Perl/string-matching-5.pl

2 lines
89 B
Perl

my $i = -1; print $i, "\n" while ($i = index $str1, $str2, $i + 1) != -1; # using index