Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Multi-dimensional constants

by navalned (Beadle)
on Nov 22, 2020 at 16:53 UTC ( [id://11124026]=note: print w/replies, xml ) Need Help??


in reply to Multi-dimensional constants

I would recommend trying `Readonly'.

use Readonly; Readonly my @readonly => (['book', 'pen', 'pencil'], ['bat', 'ball', 'glove'], ['snake', 'rat', 'rabbit']); print $readonly[0][0], "\n"; $readonly[0][0] = "comicbook"; 1;

Outputs the following:
book
Modification of a read-only value attempted at ./readonly.pl line 11
Plus you should be able to fill in the array at runtime so that should give you more flexibility.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-25 05:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found