in reply to Re: Finding the positions of a character in a string
in thread Finding the positions of a character in a string

I found this to be about 30% faster than by_index and something over 10% faster than by_regex2
by_index2 => sub { my @offsets; for (my $p = 0; ($p = index($str, "\n", $p)) > 0; push @offset +s, $p++) { } \@offsets; # I made all of them return a ref to the array so I + could check results },

Caution: Contents may have been coded under pressure.