in reply to Is this an efficient way check for certain conditions?

The idea looks fine, but the (pseudo?)code needs a bit of improvement.

First, 'foo_1' and 'foo_2' are probably supposed to be scalars, they need to be prefaced with a dollar sign ($foo_1,$foo_2). Second, your if..elsif..else construct has a few extra semicolons in it. Third, I think your "do" lines are really placeholders, which need to be commented out. Fourth, the "do" statements don't seem to be in the right place. After fixing that we now have:

if (defined($foo_2)){ # do something with $foo_2 } elsif (defined(foo_1)){ # do something with $foo_1 } else { # take defalut action }
(note, indentation of if/else is one of those holy wars... some might prefer a different indentation)

-Blake