"Sitha Nhok" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, if I have a multidimensional array like : > > @AoA = ( > ["ABC", "BCD"], > ["CDE", "DEF"], > ["EFG", "FGH"], > ); > > > then do: > > @var = splice @AoA, 2, 1; # to delete the last row > > print @var; #print what was returned from splice > > > > The print statement prints an address. I like it to print the contents > that was removed. How do I do that? >
Just to make sure you understand, when you create an array of arrays like this, your actually creating one top level array (ie @AoA) each element of which is a reference to an anonymous (created by your ["ABC... declaration). What you're printing is the reference removed from the top level array. So you need to dereference it, perhaps like this... my $inner_array_ref = $var[0]; print @$inner_array_ref; This is long winded, but explains what's going on. We take the first element of the array (which we assume exists) and then print it out, put deferencing it to an array by prefixing it with a @. You could also do this... my $inner_array_ref = $var[0]; print $$inner_array_ref[1]; Which will print the second element from the inner array. You'd be well advised to read up on references, and de-referencing stuff. HTH Rob Anderson > ~Sitha > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]