aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrbaggy <js5@sanger.ac.uk>2021-02-23 05:06:12 +0000
committerdrbaggy <js5@sanger.ac.uk>2021-02-23 05:06:12 +0000
commitaa52dd453a66122e8a51ebbbe27222f7c9d47667 (patch)
tree6ebdfb13f703c08d567f6fdbb73e08f60304ab60
parent6fce46c86da21aa2e28fa353bc1c85c89cb9ee1c (diff)
downloadperlweeklychallenge-club-aa52dd453a66122e8a51ebbbe27222f7c9d47667.tar.gz
perlweeklychallenge-club-aa52dd453a66122e8a51ebbbe27222f7c9d47667.tar.bz2
perlweeklychallenge-club-aa52dd453a66122e8a51ebbbe27222f7c9d47667.zip
use @_ as easier
-rw-r--r--challenge-101/james-smith/perl/ch-2.pl6
1 files 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);