1NAME 2 List::Group - Group a list of data structures to your specifications. 3 4SYNOPSIS 5 use List::Group qw[group]; 6 my @list = qw[cat dog cow rat]; 7 my @group = group @list, cols => 2; 8 9 foreach my $row ( @group ) { 10 print "@{$row}\n"; 11 } 12 13DESCRIPTION 14 A simple module that currently allows you to group a list by columns or 15 rows. 16 17 Functions 18 "group" *listref*, *args* 19 my @table = group \@list, cols => 2; 20 21 This function returns a list-of-lists containing the elements of 22 *listref* passed as the first argument. The remaining arguments 23 detail how to group the elements. Available groupings are 24 "cols", and "rows". Each of these groupings accept a single 25 digit as a value, the number of "cols" or "rows" to create. 26 27 The following is what @table would look like from the previous 28 example. 29 30 my @list = qw[cat dog mouse rat]; 31 my @table = group \@list, cols => 2; 32 33 print Dumper \@table; 34 __END__ 35 36 $VAR1 = [ 37 [ 'cat', 'dog' ], 38 [ 'mouse', 'rat' ] 39 ]; 40 41AUTHOR 42 Casey West, <casey@geeknest.com>. 43 44COPYRIGHT 45 Copyright (c) 2004 Casey West. All rights reserved. 46 This module is free software; you can redistribute it and/or modify it 47 under the same terms as Perl itself. 48 49