This might come as a surprise but literals in Perl are always new as you can see by the references.°
DB<66> p \1 SCALAR(0x335c4a0) DB<67> p \1 SCALAR(0x335c6f8) DB<68> p \1 SCALAR(0x335cae8) DB<69>
I know there are languages where it's always the same (IMHO do Ruby and Lisp have a syntax for this) but this is not what I mean or asked.
Alas ... few of the respondents here seem to have read the code in the OP and really have a deep grasp of aliases.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) well undef is an exception, but it's debatable if that's a literal or a constant.
DB<69> p \undef SCALAR(0xfb9098) DB<70> p \undef SCALAR(0xfb9098) DB<71> p \undef SCALAR(0xfb9098) DB<72> p \undef SCALAR(0xfb9098) DB<73> p \"str" SCALAR(0x335d3c0) DB<74> p \"str" SCALAR(0x335d498) DB<75> p \"str" SCALAR(0x335d270)
In reply to Re^2: Shouldn't references be readonly?
by LanX
in thread Shouldn't LITERAL references be readonly? (updated)
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |