A regular expression for a cat to be added to the guide. Is this monstrous in the eyes of the observer:
use List::Util q/min/; my @targets = ('«','»',"\n"); my $x = q{«...«...»...«...»...»}; my $pos = min map { my $z = index($x,$_); $z<0?Inf:$z } @targets; my @pos; while ($pos < Inf) { push @pos, $pos; $pos = min map { my $z = index($x,$_,$pos+1); $z<0?Inf:$z } @targets; }
source share