From aa52dd453a66122e8a51ebbbe27222f7c9d47667 Mon Sep 17 00:00:00 2001 From: drbaggy Date: Tue, 23 Feb 2021 05:06:12 +0000 Subject: use @_ as easier --- challenge-101/james-smith/perl/ch-2.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/challenge-101/james-smith/perl/ch-2.pl b/challenge-101/james-smith/perl/ch-2.pl index e68bdbbca8..e9fbf7ed2c 100644 --- a/challenge-101/james-smith/perl/ch-2.pl +++ b/challenge-101/james-smith/perl/ch-2.pl @@ -23,9 +23,9 @@ sub winding_number { ## crosses the +ve axis (adding or subtracking 1 depending on the ## direction) - this boils down to the algorithm below.. - my @pts = @_; - my ($a,$b,$wn) = @pts[-2,-1],0; - while( my($x,$y) = splice @pts,0,2 ) { + my ( $a, $b, $wn ) = @_[ -2, -1 ], 0; + + while( my($x,$y) = splice @_, 0, 2 ) { $wn += $a<=0 ? $y>0 && $a*$y-$x*$b > 0 ? 1 : 0 : $y<=0 && $a*$y-$x*$b <= 0 ? -1 : 0; ($a,$b)=($x,$y); -- cgit