Help for this page

Select Code to Download


  1. or download this
        for (my $i = 0; $i <= $#list; $i += $C) {
            push @AoA, [ @list[$i .. $i + $C - 1] ];
        }
    
  2. or download this
    [[1 .. 4], [5 .. 8], [9 .. 12]]
    [1 .. 12]
    
  3. or download this
    [[1 .. 4], [5 .. 8], [9 .. 12], [13, 14, undef, undef]]
    [1 .. 14]
    
  4. or download this
        for (my $i = 0; $i <= $#list; $i += $C) {
            my $end = $i + $C - 1;
            $end = $#list if $end > $#list;
            push @AoA, [ @list[$i .. $end] ];
        }
    
  5. or download this
    [[1 .. 4], [5 .. 8], [9 .. 12], [13, 14]]
    [1 .. 14]
    
  6. or download this
    [[1 .. 4], [5 .. 8], [9 .. 12]]
    [1 .. 12]