diff options
| author | Niels van Dijke <perlboy@cpan.org> | 2021-09-21 09:56:49 +0000 |
|---|---|---|
| committer | Niels van Dijke <perlboy@cpan.org> | 2021-09-21 09:56:49 +0000 |
| commit | 9dd2e7bd15cc853ff802c73df24cf61e864c06a3 (patch) | |
| tree | d73f2a3893abb303562a0769ba93260a11f6dc6b | |
| parent | 72d9c0ea832c271b0f21f9b14c4d11d221cc82f3 (diff) | |
| download | perlweeklychallenge-club-9dd2e7bd15cc853ff802c73df24cf61e864c06a3.tar.gz perlweeklychallenge-club-9dd2e7bd15cc853ff802c73df24cf61e864c06a3.tar.bz2 perlweeklychallenge-club-9dd2e7bd15cc853ff802c73df24cf61e864c06a3.zip | |
Small performance change (Suggestion by Tod McQuillin)
* slightly condensed code
* add "no warnings 'once'"
| -rwxr-xr-x[-rw-r--r--] | challenge-131/perlboy1967/perl/ch-1.pl | 8 |
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; } |
