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' };
In reply to Re: Ternary Operator with Subroutine
by BrowserUk
in thread Ternary Operator with Subroutine
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |