diff options
| -rw-r--r-- | challenge-210/james-smith/perl/ch-2.pl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/challenge-210/james-smith/perl/ch-2.pl b/challenge-210/james-smith/perl/ch-2.pl index 495cfe3845..8d0c1479a8 100644 --- a/challenge-210/james-smith/perl/ch-2.pl +++ b/challenge-210/james-smith/perl/ch-2.pl @@ -13,17 +13,17 @@ my @TESTS = ( sub collision { my @st; - $_[0]>0 || !@st || $st[-1] < 0 ? ( push @st, shift ) + $_[0]>0 || !@st || $st[-1] < 0 ? push @st, shift ## +ve no, empty stack or last stack is -ve ## we keep this at the moment so push to stack - : $st[-1] == -$_[0] ? ( pop @st, shift ) + : $st[-1] == -$_[0] ? pop @st && shift ## -ve no and equal in absolute value ## remove +ve value from stack and drop ## current value - : $st[-1] >= -$_[0] ? ( shift ) + : $st[-1] >= -$_[0] ? shift ## -ve no and smaller in abs value ## drop current value - : ( pop @st ) + : pop @st ## -ve no and greater in abs value ## remove previous number from stack while @_; |
