Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Flag variables

by Anonymous Monk
on Mar 03, 2003 at 12:45 UTC ( #240010=note: print w/ replies, xml ) Need Help??


in reply to Flag variables

Problems. Poor locality of reference. Possibility that the value you set and check are unrelated. Meaningless variable name making it hard to know what the flag means - people often write code thinking the flag means X when it is true, and then slip up and treat it as NOT X instead.

Not all flags are bad. But make the flag's name a yes/no question which its value is the answer to (avoiding reversing its meaning), and don't use a flag where an alternative suggests itself.

Additional misfeature in your code. The &foo notation passes implicit arguments which is often not desired. As perlsub says, This is an efficiency mechanism that new users may wish to avoid. *ahem* Experienced users as well. :-)


Comment on Re: Flag variables

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://240010]
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-09-01 12:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (8 votes), past polls