Kieren Diment > Array-Transpose-Ragged-0.01 > Array::Transpose::Ragged

Download:
Array-Transpose-Ragged-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Array::Transpose::Ragged - Transpose a ragged array

VERSION ^

Version 0.01

SYNOPSIS ^

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.

    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']
               );

EXPORT ^

transpose_ragged(\@array)

SUBROUTINES/METHODS ^

transpose_ragged(\@array)

_max_idx ($matrix)

returns the max index length of the matrix

_normalise_lengths

normalises the length of the matrix prior to calling transpose

AUTHOR ^

Kieren Diment, <zarquon at cpan.org>

BUGS ^

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.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc Array::Transpose::Ragged

You can also look for information at:

ACKNOWLEDGEMENTS ^

LICENSE AND COPYRIGHT ^

Copyright 2010 Kieren Diment.

This program is released under the following license: BSD

See http://dev.perl.org/licenses/ for more information.

syntax highlighting: