From 337606a8afa9a655a3c1a4dc404714d3de6339ba Mon Sep 17 00:00:00 2001 From: Niels van Dijke Date: Tue, 27 Jul 2021 23:35:21 +0000 Subject: Cleanup and slightly shorter version --- challenge-123/perlboy1967/perl/ch-2.pl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/challenge-123/perlboy1967/perl/ch-2.pl b/challenge-123/perlboy1967/perl/ch-2.pl index 15a7207ac2..926188c449 100755 --- a/challenge-123/perlboy1967/perl/ch-2.pl +++ b/challenge-123/perlboy1967/perl/ch-2.pl @@ -45,7 +45,6 @@ sub areSquarePoints(\@) { # then the distance between one point and the other three # will give 2 identical and on other foreach my $i (0 .. 3) { - my @d; foreach my $j (0 .. 3) { next if ($i == $j); $dP{sqrt(($ar->[$i][0]-$ar->[$j][0])**2 + @@ -55,8 +54,6 @@ sub areSquarePoints(\@) { my @v = sort { $b <=> $a } values %dP; - return 1 if ($v[0] == 8 && $v[1] == 4); - - return 0; + return ($v[0] == 8 && $v[1] == 4 ? 1 : 0); } -- cgit