aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorE7-87-83 <fungcheokyin@gmail.com>2020-08-30 13:11:12 +0800
committerE7-87-83 <fungcheokyin@gmail.com>2020-08-30 13:11:12 +0800
commit4f4b54d683c76b76b1e2066994019da471adb684 (patch)
tree7c3ec2377d5dcf4728b8b66d5a5d8a87bbe38968
parente880654c3a1725ff513c00507baa47847d763f3c (diff)
downloadperlweeklychallenge-club-4f4b54d683c76b76b1e2066994019da471adb684.tar.gz
perlweeklychallenge-club-4f4b54d683c76b76b1e2066994019da471adb684.tar.bz2
perlweeklychallenge-club-4f4b54d683c76b76b1e2066994019da471adb684.zip
condense ch-2.pl and add blogpost of the second task
-rw-r--r--challenge-075/cheok-yin-fung/BLOG.txt1
-rw-r--r--challenge-075/cheok-yin-fung/perl/ch-2.pl6
2 files changed, 3 insertions, 4 deletions
diff --git a/challenge-075/cheok-yin-fung/BLOG.txt b/challenge-075/cheok-yin-fung/BLOG.txt
index 34c511b87d..4f7a0093a8 100644
--- a/challenge-075/cheok-yin-fung/BLOG.txt
+++ b/challenge-075/cheok-yin-fung/BLOG.txt
@@ -1 +1,2 @@
http://blogs.perl.org/users/c_y_fung/2020/08/tc.html
+http://blogs.perl.org/users/c_y_fung/2020/08/how-and-what.html
diff --git a/challenge-075/cheok-yin-fung/perl/ch-2.pl b/challenge-075/cheok-yin-fung/perl/ch-2.pl
index 4429637893..b41bfb5a29 100644
--- a/challenge-075/cheok-yin-fung/perl/ch-2.pl
+++ b/challenge-075/cheok-yin-fung/perl/ch-2.pl
@@ -11,9 +11,7 @@ my @A;
if (@ARGV) {@A = @ARGV;} else {@A = (3, 2, 3, 5, 7, 5);}
sub subtract1 {
- my @in = @_;
- my @temp = map { $_ != 0 ? $_-1 : 0 } @in;
- return @temp;
+ return map { $_ != 0 ? $_-1 : 0 } @_;
}
sub subtract_to_max {
@@ -63,7 +61,7 @@ sub lrh {
$j++;
}
}
- if ( defined($h) && defined($t)) && (!exists $areas{"$h,$t"}) ) {
+ if ( defined($h) && defined($t) && (!exists $areas{"$h,$t"}) ) {
$areas{"$h,$t"} = ($t-$h+1)*($MAX_-$i);
}
$j++;