Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Flag variables

by Anonymous Monk
on Mar 03, 2003 at 12:45 UTC ( [id://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. :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-19 11:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found