in reply to Multidimensional arrayrefs constructed from anonymous arrayrefs

I looked high and low for an example of splicing a multidimensional array and never found one.

Maybe I'm missing something, but wouldn't the following work?

use Data::Dumper; my @arr = ( [ 0 .. 2 ], [ 3 .. 5 ], [ 6 .. 8 ], ); print Data::Dumper->Dump( [\@arr] ); splice @{$arr[2]}, 1, 1; print Data::Dumper->Dump( [\@arr] ); -------- $VAR1 = [ [ 0, 1, 2 ], [ 3, 4, 5 ], [ 6, 7, 8 ] ]; $VAR1 = [ [ 0, 1, 2 ], [ 3, 4, 5 ], [ 6, 8 ] ];

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

I shouldn't have to say this, but any code, unless otherwise stated, is untested

  • Comment on Re: Multidimensional arrayrefs constructed from anonymous arrayrefs
  • Download Code