Hello b4swine,
I think you’re going to have to add a variable of your own; e.g.:
#! perl use strict; use warnings; use Data::Dump; my $count = 0; my @list = (rand(1), rand(1), rand(1)); dd \@list; for (@list) { last if $_ < 0.5; ++$count; } if ($count < @list) { print "exited via last\n"; } else { print "ran to completion\n"; }
Example output:
23:49 >perl 1610_SoPW.pl [ 0.894318423773260207, 0.645644715844781558, 0.544934475599927026, ] ran to completion 23:51 >perl 1610_SoPW.pl [ 0.0333455559602988671, 0.597882601755799215, 0.918452691557956058, ] exited via last 23:51 >
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Fall through loop
by Athanasius
in thread Fall through loop
by b4swine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |