perl -E '@arr=(\\$x,\\@x,\\%x);say \\$x;say \\@x;say \\%x'
outputs
REF(0x8e8f58)
REF(0x8e8f58)
REF(0x8e8f58)
and
perl -E '@arr=(\\$x,\\@x,\\%x);say join"\n",\\$x,\\@x,\\%x'
outputs
REF(0xdc3f58)
REF(0xdc3e38)
REF(0xde0618)
and
perl -E '@arr=(\\$x,\\@x,\\%x);say $arr[0];say $arr[1];say $arr[2]'
outputs
REF(0x19b4d48)
REF(0x19b4b98)
REF(0x19d13e8)
I think what's going on is that we're getting the address of a temporary variable. When they are all in the same statement, you need three temporary spots; when in different statements, you just reuse your scratch space.
Still doesn't answer the 'REF' question, though...
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|