Yes it is!
You can sometimes reorder your conditions to ensure that the most common (or least expensive to evaluate) comes first, but apart from that there are no glaring efficeiency problems here.
You do have a syntax error though. The semicolons after the if-clause and the endif-clause are not only superfluous but downright wrong.
The entire 'if(..){...}elseif(..){..}else{..}' is one statement. Note the braces and parentheses. They are all required.
Would be more correct. But still not quite there. Variables have a '$' in front of them (mostly), and do is not the preferred way of calling subroutines.....if (defined(foo_2)){ do bar; } elsif (defined(foo_1)){ do foo_2; } else { do foo_1; };
In reply to Re: Is this an efficient way check for certain conditions?
by htoug
in thread Is this an efficient way check for certain conditions?
by Zecho
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |