in reply to Re: positions of all occurrences of a substring in a stringin thread positions of all occurrences of a substring in a string
my @poss; my $pos = -1; while (($pos = index($string, $char, $pos + 1)) != -1) { push @poss, $pos; } [download]