Help for this page

Select Code to Download


  1. or download this
    my @arr = qw ( apples oranges bananas pears berries apricots   );
    my @arr_of_columns = split_list( \@arr, 2 );
    
  2. or download this
        ['apples', 'bananas','berries', 'prunes']
        ['oranges','pears',  'apricots']
    
  3. or download this
    my $arr_of_arr = split_list( [ 1 .. 7 ], 3, undef );
  4. or download this
        [1,4,7]
        [2,5,undef]
        [3,6,undef]
    
  5. or download this
    sub split_list {
        use integer;
        my ( $list_ref, $qty, $pad ) = @_;
    ...
        return @return if wantarray;
        return \@return;
    }