The following would also work:
my $var2 = <cond1> ? a : y;
But be careful. Even slight complexity in its arguments can make it hard to read.
In reply to Re^2: Variable Declaration
by ikegami
in thread Variable Declaration
by pp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |