Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^5: Shouldn't references be readonly?

by hippo (Bishop)
on Aug 05, 2020 at 22:07 UTC ( #11120374=note: print w/replies, xml ) Need Help??


in reply to Re^4: Shouldn't references be readonly?
in thread Shouldn't LITERAL references be readonly? (updated)

please explain the difference to your allegedly constant 1 .

Simple. Your constant a has a label. The label means that it uses a specific location to store the (constant) value. All refs to the label resolve to the location of the value and hence stringify to the same address.

By contrast 1 has no label. It is an actual literal. This does not require one specific location to store it and therefore refs to it will refer to different locations.


🦛

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11120374]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (None)
    As of 2021-10-17 14:13 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My first memorable Perl project was:







      Results (71 votes). Check out past polls.

      Notices?