Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Typeglobs and constant variables

by AnomalousMonk (Abbot)
on May 30, 2013 at 06:56 UTC ( #1035979=note: print w/ replies, xml ) Need Help??


in reply to Typeglobs and constant variables

If you don't want to declare with our or use constant (maybe also take a look at Readonly, but that seems to exact a speed penalty (Update: see thread Module Readonly, esp. the most recent reply)),  $::myVar is a little bit less typing than  $main::myVar (well, at least as long as you're in the  main package).

>perl -wMstrict -le "*myVar = \3.14159; print $::myVar; " 3.14159


Comment on Re: Typeglobs and constant variables
Select or Download Code
Re^2: Typeglobs and constant variables
by kcott (Abbot) on May 31, 2013 at 07:04 UTC
      My preference would be for Const::Fast. My reasons for this are in "Re: Use of Constants"

      One caveat -- beside the build problem -- of that module that it fails to mention, is that its "constants" aren't (compile-time) constants, but rather runtime variables that cannot be varied [sic], and thus they do not trigger Perl's compile-time optimisations.

      For me, that issue alone negate the purpose of using constants almost completely. Combined with the other two issues render it a non starter.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2014-12-25 02:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls