http://www.perlmonks.org?node_id=1153718


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 (Bishop) 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.