- $link = substr $after, 0, $trim;
- for ($offset .. $#$self) {
- last if $self->[$offset + $penalty] =~ /^\Q$link/;
- $penalty++;
+ $link = substr $self->[$after], 0, $trim;
+ # advance lookbehind offset on the next page
+ $penalty = 0;
+ for ($offset .. $after) {
+ last if $self->[$_] =~ /^\Q$link/;
+ $lookbehind++;