in reply to creating a variable in an if statement
if( do { my @f; 1 == ( @f= one() ) || 1 == ( @f= two() ) } ) {
but that still leaves the body of your 'if' statement on separate lines. So you probably want to change your semicolons to commas, add parens where needed, maybe a few more 'do's so you can use a statement-modifier 'if' instead. The number of lines is really getting out of hand here. All that whitespace makes the multiple layers of nested parens and braces not nearly as interesting to stare at.
Update: Oh, the @f doesn't survive outside of the do { }.
if( my @f= do { my @g; 1 == ( @g= one() ) || 1 == ( @g= two() ) } ) {
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: creating a variable in an if statement ("do"s)
by ikegami (Patriarch) on Jan 22, 2008 at 19:59 UTC | |
by tye (Sage) on Jan 22, 2008 at 20:15 UTC | |
by ikegami (Patriarch) on Jan 22, 2008 at 20:50 UTC | |
by tye (Sage) on Jan 22, 2008 at 21:53 UTC | |
by ikegami (Patriarch) on Jan 23, 2008 at 02:23 UTC | |
|