Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Array::Group(3)	      User Contributed Perl Documentation      Array::Group(3)

NAME
       Array::Group - Convert an array into array of arrayrefs of uniform size
       N.

SYNOPSIS
	 use Array::Group qw( :all );

	 @sample = ( 1 .. 10 );
	 $rowsize = 3;

	 ngroup	$rowsize => \@sample ;
	 # yields
		(
		   [   1,   2,	 3   ],
		   [   4,   5,	 6   ],
		   [   7,   8,	 9   ],
		   [   10   ]
		 );

	 dissect $rowsize => \@sample ;
	 # yields
		(
		   [   1,   5,	 9   ],
		   [   2,   6,	10   ],
		   [   3,   7	],
		   [   4,   8	]
		 );

DESCRIPTION
       The "ngroup" method reformats a list into a list	of arrayrefs. It is
       often used for formatting data into HTML	tables,	amongst	other things.

       "dissect()" returns a list of lists where the first element of each
       sublist will be one of the first	elements of the	source list, and the
       last element will be one	of the last.  This behaviour is	much more
       useful when the input list is sorted.

       The key difference between the two methods is that "dissect()" takes
       elements	from the start of the list provided and	pushes them onto each
       of the subarrays	sequentially, rather than simply dividing the list
       into discrete chunks.

       Both methods can	be called as either functions or class methods (to
       ensure compatibility with previous releases), and the array to be
       reformed	can be passed as a reference.

SEE ALSO
       o   Array::Reform

AUTHOR
       Currently maintained by Mike Accardo, <accardo@cpan.org>

       Original	author Terrence	Monroe Brannon.

   CONTRIBUTORS
       I would like to thank Alexandr Ciornii for his help in upgrading	this
       distribution's format. He took me from using a test.pl file to using
       the t/ directory	and removed some old crufty things that	were not
       needed.	He also	upgraded the Makefile.PL.

COPYRIGHT
	   Copyright (c) 2015 Mike Accardo
	   Copyright (c) 1999-2014 Terrence Brannon

       This library is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.

perl v5.32.0			  2020-08-08		       Array::Group(3)

NAME | SYNOPSIS | DESCRIPTION | SEE ALSO | AUTHOR | COPYRIGHT

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Array::Group&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help