in reply to Re^2: Multi-dimensional arrays...
in thread Multi-dimensional arrays...

No, the my @record = ...; inside the inner loop creates a new lexically scoped array each iteration. Consider the following code.

$ perl -Mstrict -wle ' > my @arr; > foreach my $iter ( 1 .. 3 ) > { > my @rec = map { $_ * $iter } ( 1, 2, 3 ); > push @arr, \ @rec; > } > print qq{$_: @$_} for @arr;' ARRAY(0x22aa8): 1 2 3 ARRAY(0x22b14): 2 4 6 ARRAY(0x22b80): 3 6 9 $

Note how the references are different for each element of @arr and the contents reflect the value of $iter each time through the loop.

I hope this is helpful.

Cheers,

JohnGG

Replies are listed 'Best First'.
Re^4: Multi-dimensional arrays...
by nothign (Novice) on May 31, 2009 at 19:54 UTC
    Thank you for the further clarification, excuse my ignorance. And many thanks :D