Help for this page

Select Code to Download


  1. or download this
    perl -le '$_ = "a"; print do { if( length ){ "A" } else{ "B" } };'
    
  2. or download this
    A
    
  3. or download this
    perl -le '$_ = "a"; print length ? "A" : "B" '
    
  4. or download this
    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 pat
    +tern at -e line 1.
    
  5. or download this
    perl -le '$_ = "a"; print length . '' ? "A" : "B" '
    
  6. or download this
    Use of ?PATTERN? without explicit operator is deprecated at -e line 1.
    Search pattern not terminated or ternary operator parsed as search pat
    +tern at -e line 1.
    
  7. or download this
    perl -le '$_ = "a"; print length + 0 ? "A" : "B" '
    
  8. or download this
    Warning: Use of "length" without parentheses is ambiguous at -e line 1
    +.
    A