in reply to Re^2: String comparison "\x00" vs. "".
in thread String comparison "\x00" vs. "".

Overloaded bjects and tied variables can be false, and they're none of those.

An expression is false if it stringifies to any of the following:

That includes undef and numerical zero. (It might fail for very tiny floats and weird dualvars, but it gives a good idea.)

Replies are listed 'Best First'.
Re^4: String comparison "\x00" vs. "".
by JavaFan (Canon) on Jun 08, 2010 at 16:07 UTC
    An expression is false if it stringifies to any of the following
    But it wouldn't be Perl if there wasn't an exception to that:
    use overload "bool" => sub {0}, '""' => sub {"Send in the clowns"}; my $o = bless []; # $o stringifies to "Send in the clowns" say "Hello" if $o; # No stringification happening here say "world" if "$o"; # Forced stringification
    prints just "world"