First of all, I come from C, Java, Python background. Recently, I started learning Perl for my new job and I got curious about \'0\'
(0-string) being false.
If you read that it has anything to do with <>
, you are reading bad sources; I can't imagine where that claim would come from.
'0' is false because almost everywhere perl doesn't distinguish between numbers stored in numeric form and in string form; doing so in boolean tests would run against this grain.
In languages (Python, Javascript?) where '0' is true, I find it odd that '' is false; why make an exception for one string but not the other?