in reply to Ternary Operator with Subroutine
This would work:
( my $test ) ? print 'c' : sub { print 'a'; print 'b' }->();
But this is probably what you want:
( my $test ) ? print 'c' : do{ print 'a'; print 'b' };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Ternary Operator with Subroutine
by egga (Monk) on Aug 12, 2011 at 08:37 UTC | |
by BrowserUk (Patriarch) on Aug 12, 2011 at 08:48 UTC | |
|
Re^2: Ternary Operator with Subroutine
by Jim (Curate) on Aug 14, 2011 at 16:24 UTC | |
by BrowserUk (Patriarch) on Aug 14, 2011 at 17:39 UTC |