my $i = 0; while ( $i != -1 ) { $i = index( $text, "ll", $i ); if ( $i != -1 ) { print $i, "\n"; $i = $i + 1; } }