in reply to Re: Re: Re: Passing Array of Arrays
in thread Passing Array of Arrays
Now with nested data structures this is still exactly the same as references aren't automagically dereferenced e.gmy @a = qw( foo bar baz ); my %h = qw( one ichi two ni ); ## print evaluates it's args in list context print "array: ", @a,$/; print "hash: ", %h,$/; print "a & h: ", @a, %h, $/; __output__ array: foobarbaz hash: oneichitwoni a & h: foobarbazoneichitwoni
So because subroutines' arguments are evaluated in list context an AoA is fine and dandy to pass about without having to create a reference to it.my @a = ( ["one"], ["two"] ); my %h = ( a => \@a ); print "array: ", @a, $/; print "hash: ", %h, $/; __output__ array: ARRAY(0x80fbb0c)ARRAY(0x80fba1c) hash: aARRAY(0x8107d84)
_________
broquaint
|
|---|