in reply to Re^4: Automatically add all defined functions to your @EXPORT
in thread Automatically add all defined functions to your @EXPORT
In preference toif( $var1 == 1 ) { if( $var2 == 2 ) { doSomething(); } }(would you?).if( $var1 == 1 && $var2 == 2 ) { doSomething(); }
Actually, I quite often find that the first of these two is exactly what I want as it makes what I'm doing much more clear. Othertimes, I use the latter. It really depends on whether the two tests are related or not, as well as whether there are other things I want to do in the $var==1 case but only if $var2!=2.
So I often find myself writing a grep of a grep. Or a grep of a map of a map of a grep. Or a map of a grep of a grep. Or ... when a single map may just do fine.
Your first example, having two if's to check the same thing, isn't really analogous to combining grep's since each grep is checking different things.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Automatically add all defined functions to your @EXPORT
by BrowserUk (Patriarch) on Jun 21, 2005 at 17:09 UTC | |
|
Re^6: Automatically add all defined functions to your @EXPORT
by Transient (Hermit) on Jun 21, 2005 at 17:09 UTC |