in reply to in search of a more elegant if then else

You can use the ternary operator

my $var = (condition) ? value1 : value2;