Hacker News new | ask | show | jobs
by jstanley 1720 days ago
Perl has this too. The string "0 but true" is truthy, but is 0 as a numeric value.

(Any string starting with 0 that doesn't evaluate to a different number also works - but "0 but true" is specifically exempt from causing warnings).

DBI uses "0E0" instead, which I guess more reliably evaluates to 0 outside Perl, and still doesn't cause warnings.