From 93ee64552c1f01ab842b6877e549d44fe824bd89 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Mon, 14 Sep 2020 09:47:27 +0100 Subject: Shorten code --- challenge-078/dave-cross/perl/ch-2.pl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/challenge-078/dave-cross/perl/ch-2.pl b/challenge-078/dave-cross/perl/ch-2.pl index 601ddd9520..47c45d8708 100644 --- a/challenge-078/dave-cross/perl/ch-2.pl +++ b/challenge-078/dave-cross/perl/ch-2.pl @@ -8,10 +8,7 @@ my ($array, $idx) = @ARGV; my @array = split /,/, $array; my @idx = split /,/, $idx; -for (@idx) { - my @rotated = rotate($_, @array); - say '[', join(', ', @rotated), ']'; -} +say '[', join(', ', rotate($_, @array)), ']' for @idx; sub rotate { my ($idx, @array) = @_; -- cgit