perl -le '$_ = "a"; print do { if( length ){ "A" } else{ "B" } };' #### A #### perl -le '$_ = "a"; print length ? "A" : "B" ' #### Warning: Use of "length" without parentheses is ambiguous at -e line 1. Use of ?PATTERN? without explicit operator is deprecated at -e line 1. Search pattern not terminated or ternary operator parsed as search pattern at -e line 1. #### perl -le '$_ = "a"; print length . '' ? "A" : "B" ' #### Use of ?PATTERN? without explicit operator is deprecated at -e line 1. Search pattern not terminated or ternary operator parsed as search pattern at -e line 1. #### perl -le '$_ = "a"; print length + 0 ? "A" : "B" ' #### Warning: Use of "length" without parentheses is ambiguous at -e line 1. A