aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-09-21 12:01:37 +0100
committerGitHub <noreply@github.com>2021-09-21 12:01:37 +0100
commit00f2fe4ccefa92e2af31c4bb23ccd272c586f94d (patch)
treecc8c44514d5c84211324a14efcb34151ac60dcc5
parent2576f41493de9d47a1c5bbc2acfe7e05a9efa2be (diff)
parent9dd2e7bd15cc853ff802c73df24cf61e864c06a3 (diff)
downloadperlweeklychallenge-club-00f2fe4ccefa92e2af31c4bb23ccd272c586f94d.tar.gz
perlweeklychallenge-club-00f2fe4ccefa92e2af31c4bb23ccd272c586f94d.tar.bz2
perlweeklychallenge-club-00f2fe4ccefa92e2af31c4bb23ccd272c586f94d.zip
Merge pull request #4905 from PerlBoy1967/branch-for-challenge-131
Small performance change (Suggestion by Tod McQuillin)
-rwxr-xr-x[-rw-r--r--]challenge-131/perlboy1967/perl/ch-1.pl8
1 files changed, 3 insertions, 5 deletions
diff --git a/challenge-131/perlboy1967/perl/ch-1.pl b/challenge-131/perlboy1967/perl/ch-1.pl
index 05558a8351..06f3d68023 100644..100755
--- a/challenge-131/perlboy1967/perl/ch-1.pl
+++ b/challenge-131/perlboy1967/perl/ch-1.pl
@@ -26,18 +26,16 @@ done_testing;
sub consecutiveArrays {
-
my @r = ([]);
+ no warnings 'once';
slide {
push(@{$r[-1]}, $a);
- if ($a != $b - 1) {
- push(@r, []);
- }
+ push(@r, []) if ($a != $b - 1);
} @_;
push(@{$r[-1]}, $_[-1]);
- return [@r];
+ return \@r;
}