Dan Anderson wrote: > > But what's the speed concerns here? This is negligable. > > I just double checked and each if statement takes roughly 9.8 > microseconds more to execute then an elsif. That may not seem like a > lot but over a program spanning several files (perhaps as much as a meg > in code when finished) and using thousands of if statements there is a > huge difference in the amount of time taken, esp. if it's a web program > being used by a number of users simultaneously.
Don't code for speed. A program that finishes afew seconds faster is not helpful if it mashes your data while doing so. I think your formatting may reflect a misconception about if and elsif staements. while ($foo) { if ($condition_1) { do_1(); } elsif ($condition_2) { do_2(); } # ... } Should be: while ($foo) { if ($condition_1) { do_1(); } elsif ($condition_2) { do_2(); } # ... } Sounds sort of anal, huh? Well, it's not. The if construct alone is a single logical operation. Any elsif is part of a multichoice construct that inherently includes its percursor. Code for logic, using an if block for each statement if there is some reason why more than one condition can apply, and when each condition should cause the execution of the related code. Use elsif only if the conditions are mutually exclusive or only the first condition found true should trigger the related code block. Code for logic, not for speed. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]