GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  LIST::GROUP (3)

.ds Aq ’

NAME

List::Group - Group a list of data structures to your specifications.

CONTENTS

SYNOPSIS



  use List::Group qw[group];
  my @list  = qw[cat dog cow rat];
  my @group = group @list, cols => 2;

  foreach my $row ( @group ) {
    print "@{$row}\n";
  }



DESCRIPTION

A simple module that currently allows you to group a list by columns or rows.

    Functions

group listref, args


  my @table = group \@list, cols => 2;



This function returns a list-of-lists containing the elements of listref passed as the first argument. The remaining arguments detail how to group the elements. Available groupings are cols, and rows. Each of these groupings accept a single digit as a value, the number of cols or rows to create.

The following is what @table would look like from the previous example.



  my @list  = qw[cat dog mouse rat];
  my @table = group \@list, cols => 2;

  print Dumper \@table;
  __END__

  $VAR1 = [
    [ cat, dog ],
    [ mouse, rat ]
  ];



AUTHOR

Casey West, <casey@geeknest.com>.

COPYRIGHT



  Copyright (c) 2004 Casey West.  All rights reserved.
  This module is free software; you can redistribute it and/or modify it
  under the same terms as Perl itself.



Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 LIST::GROUP (3) 2004-02-24

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.