my $sixth; if (defined $a) { $sixth = $a; } else { $sixth = 3; } #### my $sixth = defined $a ? $a : 3; # or this my $sixth = $a // 3;