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-