-
-
23 Jun 2014 22:54:34 UTC
- Distribution: List-Zip
- Module version: 0.04
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (1)
- Testers (475 / 0 / 0)
- Kwalitee
Bus factor: 0- 100.00% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (10.09KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- Lloyd Griffiths (lloydg@cpan.org)
- Dependencies
- Test::Simple
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
List::Zip - Module to zip lists.
DESCRIPTION
Provides functionality to zip lists. The provided subroutine returns a list formed from the input lists.
List::MoreUtils also provides functionality to
mesh
lists. However, this implementation differs. If the lists passed tozip
have different sizes all the the lists will be truncated to the same size as the smallest list.SYNOPSIS
use List::Zip; my @zipped = List::Zip->zip( [ 1, 2, 3, 4, 5 ], [ 'one', 'two', 'three', 'four', 'five' ] ); say $zipped[0]->[0]; # 1 say $zipped[0]->[1]; # one say $zipped[1]->[0]; # 2 say $zipped[1]->[1]; # two # We can get back to the original structure before zipping by zipping # the list again with no additional lists my @unzipped = List::Zip->zip(@zipped); say for @{ $unzipped[0] }; # 1 2 3 4 5 say for @{ $unzipped[1] }; # one two three four five
METHODS
zip
Converts this list by combining corresponding elements from the input lists into lists.
my $zipped = List::Zip->zip([ 1 .. 5 ], [ 6 .. 10 ]);
The structure of the list returned by zipping the above is:
[ 1, 6 ], [ 2, 7 ], [ 3, 8 ], [ 4, 9 ], [ 5, 10 ]
EXPORTS
None. Methods provided by this module are class methods so should be invoked by the class.
List::Zip->zip(@lists);
SEE ALSO
AUTHOR
Lloyd Griffiths
COPYRIGHT
This software is copyright (c) 2014 by Lloyd Griffiths.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install List::Zip, copy and paste the appropriate command in to your terminal.
cpanm List::Zip
perl -MCPAN -e shell install List::Zip
For more information on module installation, please visit the detailed CPAN module installation guide.