in reply to Conditional Elimination
Put the conditions in a sub. Then you can test things piece-wise with multiple ifs. Arrange them so that the first if will most likely return a fail. This makes the sub decide early and speeds up the code.
sub some_test { my ( $a, $b, $p, $s ) = @_; return 0 if $a ne 'A'; return 0 if $b ne 'C'; ... }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Conditional Elimination
by JavaFan (Canon) on Aug 30, 2011 at 20:00 UTC | |
by shawnhcorey (Friar) on Aug 30, 2011 at 22:56 UTC | |
by JavaFan (Canon) on Aug 31, 2011 at 00:44 UTC | |
by dsheroh (Monsignor) on Aug 31, 2011 at 09:03 UTC | |
by JavaFan (Canon) on Aug 31, 2011 at 12:13 UTC | |
| |
by shawnhcorey (Friar) on Aug 31, 2011 at 14:21 UTC |