my $sixth = defined $a ? $a : 3; # or this my $sixth = $a // 3;