Array::Transpose::Ragged - Transpose a ragged array
Version 0.01
Array::Transpose is a handy module to transpose a regular matrix. However, using it with an irregular matrix will result in data loss. This module transposes a ragged matrix. Note that it will not preserve values which are undef.
undef
use warnings; use strict; use Array::Transpose::Ragged qw/transpose_ragged/; my @array = ( [qw /00 01/], [qw /10 11 12/], [qw /20 21/], [qw /30 31 32 33 34/], ); my @transpose = transpose_ragged(\@array);
The variable @transpose will now be:
@transpose = (['00' ,'10' ,'20' ,'30'], ['01' ,'11' ,'21' ,'31'], [undef,'12' ,undef,'32'], [undef,undef,undef,'33'], [undef,undef,undef,'34'] );
transpose_ragged(\@array)
returns the max index length of the matrix
normalises the length of the matrix prior to calling transpose
transpose
Kieren Diment, <zarquon at cpan.org>
<zarquon at cpan.org>
The implementation could probably be far more efficient.
Please report any bugs or feature requests to bug-array-transpose-ragged at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Array-Transpose-Ragged. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-array-transpose-ragged at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Array::Transpose::Ragged
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Array-Transpose-Ragged
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Array-Transpose-Ragged
CPAN Ratings
http://cpanratings.perl.org/d/Array-Transpose-Ragged
Search CPAN
http://search.cpan.org/dist/Array-Transpose-Ragged/
Copyright 2010 Kieren Diment.
This program is released under the following license: BSD
See http://dev.perl.org/licenses/ for more information.
To install Array::Transpose::Ragged, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Array::Transpose::Ragged
CPAN shell
perl -MCPAN -e shell install Array::Transpose::Ragged
For more information on module installation, please visit the detailed CPAN module installation guide.