use 5.010; foreach my $n ( 0 .. $#array/3 ) { my $i = $n * 3; say join q{,}, @array[ $i, $i+1, $i+2 ]; }