in reply to YAML's No in Perl

Perl evaluates 0, undef and '' (empty string) as false in scalar context. It evaluates () (empty list) as false in list context. Any other string evaluates as true. I don't see what's wrong with that; if "No" evaluates false, what about "NO", "no", "N" ? What about "Non", "Niet", "Nein" and "La'" ?

Replies are listed 'Best First'.
Re^2: YAML's No in Perl
by adrianh (Chancellor) on Mar 13, 2006 at 12:22 UTC
    I don't see what's wrong with that; if "No" evaluates false, what about "NO", "no", "N" ? What about "Non", "Niet", "Nein" and "La'" ?

    In YAML it can be a representation of a boolean value - see Boolean Language-Independent Type for YAML™ Version 1.1 for details. So it can make sense for a YAML parser to translate this to a false value in Perl land.

      I see. It could be then a nice feature to add to the YAML module. After all, it's only an alpha release : latest is 0.58.

        CPAN version numbers and their relationship to "1" have nothing to do with alpha status. A few authors adopt the <1==alpha|beta meaning but not most of them.

        ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊