Created
December 11, 2016 00:35
-
-
Save aero/58812ec15f570ecfcdc74ad669e20cb6 to your computer and use it in GitHub Desktop.
5개씩 묶기
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
my @m = 1..17; | |
my @m5; | |
my $step = 5; | |
my ($is, $ie) = (0, $step-1); | |
while (1) { | |
push @m5, [ @m[$is .. $ie] ]; | |
last if $ie >= $#m; | |
$is += $step; | |
$ie += ($#m-$ie > $step ? $step : $#m-$ie); | |
} | |
print Dumper(\@m5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment