Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Readonly oddity

by dmitri (Priest)
on Jan 27, 2016 at 01:06 UTC ( [id://1153718]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Readonly oddity
in thread Readonly oddity

> I personally don't like constant because it is not suitable for any complex structures

For example?

Replies are listed 'Best First'.
Re^4: Readonly oddity
by kcott (Archbishop) on Jan 27, 2016 at 06:11 UTC

    The documentation for constant explains this.

    "For example?"

    The NOTES section of that documentation has an example.

    — Ken

      You mean the array reference example? It only says that you can change the values, not that it's "not suitable." It's quite suitable, I use it all the time.
        use 5.014; use strict; use warnings; use constant FOO => [ qw(BAR BAZ) ]; push @{FOO()}, qw(BOO HAHA); say join " ", @{FOO()}; @{FOO()} = split / /, "what are you using such constants for?"; say join " ", @{FOO()};
        Oh, yeah, also I don't like that you have to add () to those constants in some cases.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-04-24 19:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found