aboutsummaryrefslogtreecommitdiff
path: root/challenge-165
diff options
context:
space:
mode:
authore78783 <fungcheokyin@gmail.com>2022-05-17 17:34:38 +0800
committere78783 <fungcheokyin@gmail.com>2022-05-17 17:34:38 +0800
commit1a824ba3aa0d2be05a6cb415c21ae82bd5fa853e (patch)
treedc28854a4642019cc509b0af8511331bdfc8d429 /challenge-165
parent1cf20f45072a719aa11a0f4a21f79f33f93d6124 (diff)
downloadperlweeklychallenge-club-1a824ba3aa0d2be05a6cb415c21ae82bd5fa853e.tar.gz
perlweeklychallenge-club-1a824ba3aa0d2be05a6cb415c21ae82bd5fa853e.tar.bz2
perlweeklychallenge-club-1a824ba3aa0d2be05a6cb415c21ae82bd5fa853e.zip
prettier Task 1
Diffstat (limited to 'challenge-165')
-rw-r--r--challenge-165/cheok-yin-fung/perl/ch-1.pl5
1 files changed, 4 insertions, 1 deletions
diff --git a/challenge-165/cheok-yin-fung/perl/ch-1.pl b/challenge-165/cheok-yin-fung/perl/ch-1.pl
index a6fb13ad2c..1c14bdfc89 100644
--- a/challenge-165/cheok-yin-fung/perl/ch-1.pl
+++ b/challenge-165/cheok-yin-fung/perl/ch-1.pl
@@ -9,18 +9,21 @@ use SVG;
use ARGV::OrDATA;
my $img = SVG->new;
+my @points;
while (<>) {
chomp;
my @nums = split ",", $_;
if (scalar @nums == 2) {
- new_point(@nums);
+ push @points, [@nums];
}
elsif (scalar @nums == 4) {
new_line(@nums);
}
}
+new_point($_->@*) foreach @points; #so that the lines won't be over points
+
sub new_point {