in reply to Transpose a bi-dimensional array
tye has written a tool that should serve your purpose. Have a look at mapcar
Updateuse mapcar; my @matrix = ( [ qw(ab cd ef gh)], [ qw(ij kl mn op)], [ qw(qr st uv wx)] ); my @transposed = mapcar {[@_]} @matrix; print join( " ", @$_), $/ for @transposed; __END__ ab ij qr cd kl st ef mn uv gh op wx
The above example would becpme:
use Algorithm::Loops qw(MapCar); my @matrix = ( [ qw(ab cd ef gh)], [ qw(ij kl mn op)], [ qw(qr st uv wx)] ); my @transposed = MapCar {[@_]} @matrix; print join( " ", @$_), $/ for @transposed;
With exactly the same result.
|
|---|