Why does Perl use the empty string to represent the boolean false value?

前端 未结 5 1300
谎友^
谎友^ 2020-12-06 05:04

When evaluating an expression in a scalar (boolean) context, Perl uses the explicit value 1 as a result if the expression evaluates to true and the empty string

5条回答
  •  天涯浪人
    2020-12-06 05:30

    It's not just "" that's false in Perl. As for why... it's either because Perl is awesome or terrible -- depending on your personal preferences :)

提交回复
热议问题