From 2aebc498393b08f2d6249ef5fdc0697f64cf9f30 Mon Sep 17 00:00:00 2001 From: James Smith Date: Tue, 21 Mar 2023 15:47:31 +0000 Subject: Update ch-1.pl --- challenge-209/james-smith/perl/ch-1.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/challenge-209/james-smith/perl/ch-1.pl b/challenge-209/james-smith/perl/ch-1.pl index c5a908afd5..7539610ef9 100644 --- a/challenge-209/james-smith/perl/ch-1.pl +++ b/challenge-209/james-smith/perl/ch-1.pl @@ -9,17 +9,17 @@ use Benchmark qw(cmpthese timethis); my @TESTS = ( [ [1,0,0] => 1 ], [ [1,1,1,0] => 0 ], - [ [1,1,1] => -1 ], + [ [1,1,1] => 0 ], ); sub special_bit_chars { - return -1 if $_[-1]; + return 0 if $_[-1]; ($_[0]&&shift),shift until @_<2; scalar @_ } sub special_bit_chars_reverse { - my$f,pop?return-1:pop||return 1; - $f=!$f,pop||last while@_; - ~~$f + my$f,pop?return 0:pop||return 1; + $f++,pop||last while@_; + 1&$f } -- cgit