my @poss; my $pos = -1; while (($pos = index($string, $char, $pos + 1)) != -1) { push @poss, $pos; }
In reply to Re^2: positions of all occurrences of a substring in a string
by Anonymous Monk
in thread positions of all occurrences of a substring in a string
by carolw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |