in reply to Fall through loop
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";
|
|---|