in reply to Re: Shouldn't references be readonly?
in thread Shouldn't LITERAL references be readonly? (updated)
> The {} and [] operators construct new aggregates each time they are evaluated.
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)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Shouldn't references be readonly?
by jcb (Parson) on Aug 05, 2020 at 21:48 UTC | |
by LanX (Sage) on Aug 05, 2020 at 21:56 UTC | |
by hippo (Bishop) on Aug 05, 2020 at 22:07 UTC | |
by jcb (Parson) on Aug 05, 2020 at 22:01 UTC | |
by LanX (Sage) on Aug 05, 2020 at 22:11 UTC | |
by jcb (Parson) on Aug 05, 2020 at 22:18 UTC |
In Section
Seekers of Perl Wisdom