I have something that I can do easily in Perl, but not in Raku without fiddling around with flag variables. Here's the Perl code:
#!/usr/bin/perl
MAIN_BLOCK: {
foreach $item (1 2 3 4 5) {
$item == 6 and last MAIN_BLOCK;
}
print "No items matched!\n";
}
The relevant difference here is that Perl will allow you to use last to exit from any labelled block. Raku will only do this if the block is a loop.
Is there a good way to do this? I feel like there should be a phaser for this, but haven't figured out how to do it without flag variables, which seem like they should be avoidable.
Thanks,
leave MAIN_BLOCK
(instead oflast MAIN_BLOCK
). In practice it will currently net you aleave not yet implemented. Sorry.
message. Filed many years ago asleave
NYI. Issues since then about the relatedLEAVE
phaser include 1, 2, 3. So don't hold your breath forleave
... – Pier