in reply to Nested OR as a control structure
Did you try something like this...
#!/usr/local/bin/perl use strict; use warnings; my $p = 9; if ( $p ) { sub { printf "$p < 3 ? %s\n" , $p < 3 ? 'yes' : 'no'; return 0; }->() or sub { printf "$p > 3 ? %s\n" , $p > 3 ? 'yes' : 'no'; return 0; }->() or print "I forgot my Math: $p <!> 3!\n" ; }
In other words, if your subs return appropriate truth values, then your posted example should work. Mind you can bundle your subs w/ exit() in anonymous sub references similar to as shown above.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Nested OR as a control structure
by andyf (Pilgrim) on Jun 02, 2004 at 23:32 UTC |