Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^4: Accessing main::Constant

by Anonymous Monk
on Dec 17, 2009 at 08:01 UTC ( #813154=note: print w/replies, xml ) Need Help??

in reply to Re^3: Accessing main::Constant
in thread Accessing main::Constant

I've a similar scenario to be addressed,

I've a hash in the pl file, which I need access it from a module. when Instead of using like $main::VAR->{a}->{b} everytime, Instead I wanted to make it($main:VAR) as a constant and When I need to do that operation, I will be calling it like CONSTANT->{a}->{b}.

Am I doing it right?!

Replies are listed 'Best First'.
Re^5: Accessing main::Constant
by desemondo (Hermit) on Dec 17, 2009 at 08:49 UTC
    What is the benefit in declaring a constant that contains a reference to a data structure? It doesn't make the child elements readonly...

    Also, I avoid use constant wherever possible and use Readonly instead. In my opinion its far more flexible...
      Also, I avoid use constant wherever possible and use Readonly instead.

      Then you are a victim of marketing and hyperbole.

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://813154]
LanX where is the camera?
Tux => $HOME
[Eily]: you wrote boos instead of boss, and jedikaiti read that as boobs :)
[LanX]: Win claims only 8 MB left on C: how do I find out where the problem happens?
[Eily]: by Tux. And going home sounds like a good idea
[Eily]: LanX pretty much everywhere except in 8MB ?
[Eily]: s/by/bye/ someone hacked my keyboard I'm sure
[LanX]: good point! :)
[Eily]: LanX I don't understand the question though, you want to know what is taking so much space?
[Tanktalus]: Probably the swapfile :)

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (13)
As of 2017-09-20 16:42 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (237 votes). Check out past polls.