Subject: | Bug with redo/next/last |
Example at: https://perlbot.pl/p/8pp2ky
The error isn't immediately clear what the problem is (without knowing perl internals) and the caveat that it doesn't work isn't documented with the module. Enclosing the use of next/redo/last inside a do{} block works around the issue.
Show quoted text
--- Error ---
ARGH: Unsure how to handle OP_(NEXT|LAST|REDO) with a sibling at (IRC) line 30.
--- Code below ---
use v5.26;
use Syntax::Keyword::Try;
# This loop works.
for my $i (1..10) {
try {
say "$i, 1";
do {next};
say "$i, 2";
} catch {
say "$i, 3";
} finally {
say "$i, 4";
}
say "$i, 5";
}
# This loop doesn't work.
for my $i (1..10) {
try {
say "$i, 1";
next;
say "$i, 2";
} catch {
say "$i, 3";
} finally {
say "$i, 4";
}
say "$i, 5";
}