Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Naming Convention For Global Variables?

by CountZero (Bishop)
on Sep 28, 2012 at 20:42 UTC ( #996290=note: print w/replies, xml ) Need Help??

in reply to Naming Convention For Global Variables?

Whatever works for you is OK. And if you document it and abide by your own rules, then it should be OK for any future maintenance programmer looking after your code.

Personally I limit the use of all uppercase (lexical) variable-names to filehandles.

I try not to have really global variables. Any data should go in and out of modules, objects, subroutines, functions, ... only through parameters and return values and never through global variables. The scope of my variables is limited as much as possible.

I only have one exception and that are global configuration parameters, which are always inside the %config hash and are only accessed through this hash.


A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996290]
[Datz_cozee75]: sometimes I feel like a future friar, other times I feel the fryee

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2018-06-21 22:17 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (120 votes). Check out past polls.