in reply to nested tabular ternary

I think the problem here is you haven't really laid out all the possible scenarios. Let's try doing this in English and we'll see where we get: You haven't addressed the possibility that (major_length is neither 4800 nor 8852) nor that (major_length is 8852 but val is neither 1 nor 4). Now, it may be that in your application these scenarios are impossible, but the ?: operator does not allow you to simple ignore them. You may find it easier to use an if-else construct instead:
if ($major_length == 4800) { $result = 18; } elsif ($major_length == 8552) { if ($val == 4) { $result = 33; } elsif ($val == 1) { $result = 18; } }
You still have the possibility of those unhandled situations, but now they'll simply result in $result not getting assigned at all.