Skip to content

Instantly share code, notes, and snippets.



Created Dec 11, 2016
What would you like to do?
5개씩 묶기
#!/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
You can’t perform that action at this time.