in reply to Re^2: saving nested arrays in a hash
in thread saving nested arrays in a hash

Lets say @something is at memory location 0x12345

$ref= \@something; print $ref; # would print 0x12345, right? $ref2= \@something; print $ref2; # would print 0x12345 as well

Obvious, right? You take a reference to the array, it will be always the same. Now the other case:

$ref= [ @something ]; # would be the same as $ref= \( @something ); # if that syntax where possible, or my @x= ( @something ); # with correct syntax $ref= \@x;

i.e. [] is just () with an additional reference-taking. And by doing ( @array ) you are creating a new array (at a new memory address) with the contents of @array filled in

( @array ) is not the same as @array. This is obvious when you look at @newarray= ( @array1, @array2 );. It can't be the same