You could throw an exception instead of using last:
#!/usr/bin/env perl use strict; use warnings; use Try::Tiny; my @list = (rand(1), rand(1), rand(1)); my $less = 1; try { for (@list) { die if $_ >= 0.5; } } catch { $less = 0; }; print "$less\n";
In reply to Re: Fall through loop
by hippo
in thread Fall through loop
by b4swine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |