in reply to Re^2: Variable Declaration
in thread Variable Declaration
A third option is
my $var2 = do { if ( <cond1> ) { a; } else { y; } };
All three constructs are more-or-less interchangable and which one you use should be decided based on which is most readable in any particular instance.
In Section
Seekers of Perl Wisdom