Please use code tags. I think you want (not valid perl):
my $var2; if <cond1> { $var2 = a; } else { $var2 = y; } [download]
In reply to Re: Variable Declaration by derby in thread Variable Declaration by pp