diff options
| -rw-r--r-- | challenge-147/james-smith/README.md | 4 | ||||
| -rw-r--r-- | challenge-147/james-smith/perl/ch-1-right.pl | 2 | ||||
| -rw-r--r-- | challenge-147/james-smith/perl/ch-1.pl | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/challenge-147/james-smith/README.md b/challenge-147/james-smith/README.md index 6941c1b663..13e84e0c1b 100644 --- a/challenge-147/james-smith/README.md +++ b/challenge-147/james-smith/README.md @@ -49,7 +49,7 @@ my @tprimes_current = (3,7); printf $TEMPLATE, ++$index, $_, time-$t0 for 2,3,5,7; while(1) { # ** Stop if there are no primes of length `n`. - last unless @tprimes_current; + @tprimes_current||last; my @tprimes_new = (); # ** Loop through each of possible left-truncatable primes... for my $first ( 1..9 ) { @@ -109,7 +109,7 @@ my @tprimes_current = (2,3,5,7); printf $TEMPLATE, ++$idx, $_, time - $t0 foreach @tprimes_current; for my $p ( 1 .. 100 ) { - last unless @tprimes_current; + @tprimes_current||last; my @tprimes_new = (); foreach my $base ( @tprimes_current ) { B: foreach my $last ( 1,3,7,9 ) { diff --git a/challenge-147/james-smith/perl/ch-1-right.pl b/challenge-147/james-smith/perl/ch-1-right.pl index 9565a26b0f..ef094dcf7b 100644 --- a/challenge-147/james-smith/perl/ch-1-right.pl +++ b/challenge-147/james-smith/perl/ch-1-right.pl @@ -12,7 +12,7 @@ my @tprimes_current = (2,3,5,7); printf $TEMPLATE, ++$idx, $_, time - $t0 foreach @tprimes_current; for my $p ( 1 .. 100 ) { - last unless @tprimes_current; + @tprimes_current||last; my @tprimes_new = (); foreach my $base ( @tprimes_current ) { B: foreach my $last ( 1,3,7,9 ) { diff --git a/challenge-147/james-smith/perl/ch-1.pl b/challenge-147/james-smith/perl/ch-1.pl index 3d9b2ccf72..2f0c0641cb 100644 --- a/challenge-147/james-smith/perl/ch-1.pl +++ b/challenge-147/james-smith/perl/ch-1.pl @@ -34,8 +34,8 @@ my @tprimes_current = (3,7); printf $T, ++$index, $_, time-$t0 for 2,3,5,7; while(1) { - last unless @tprimes_current; ## Exit if there are no current l-trunc primes - ## We are at the end of the list... + @tprimes_current||last; ## Exit if there are no current l-trunc primes + ## We are at the end of the list... my @tprimes_new = (); |
