んー、文字列探索のパッケージがありそうな気がするけど。てけとうに作って見た。

sub start {
my ($item, $sub) = @_;

return sub{
my ($str) = @_;
my $start = 0;
while((my $new = index($str, $item, $start)) >= 0){
$start = $new+length($item);
$sub->(\$str, $start, length($str), $item);
}
};
}

sub without {
my ($item, $sub) = @_;

return sub{
my ($str, $start, $end, $result) = @_;
my $new = index(${$str}, $item, $start);
$end = $new if ($new >= 0 && $new < $end);
$sub->($str, $start, $end, $result);
};
}