in reply to Joining and splitting two dimensional arrays

Just as an exercise (as I'm still trying to master 2D arrays) I thought I'd try to roll my own solution. Here it is, FWIW:

use strict; use warnings; my @ary = ( [ 'fred', 'barney' ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], [ 'george', 'jane', 'elroy' ], [ 'homer' ] ); my $str = ''; for ( @ary ) { unshift @$_, $#$_; $str .= "\0" if $str; $str .= join "\0", @$_; } # And then at the other end: my @in = split /\0/, $str; my @new_ary; push @new_ary, [ splice @in, 0, shift @in ] while @in; print "@$_\n" for @new_ary;

Comments more than welcome

dave