Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Flag variables

by robartes (Priest)
on Mar 03, 2003 at 10:57 UTC ( #239996=note: print w/replies, xml ) Need Help??


in reply to Flag variables

I would say it detracts from code clarity and locality (sp?): your someaction depends on some other piece of code (the conditional setting of $flag) which could be several lines away. If all you want to do is someaction, the $flag is totally superfluous - just do the action directly:
foreach my $var (@somearray){ if($var eq "foo"){ someaction(); last;} }
More learned minds than mine will undoubtedly come up with other reasons why flag variables are often "bad".

CU
Robartes-

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2016-10-01 21:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (7 votes). Check out past polls.