in reply to
OEO, a zero that evaluates to true?
Blakem pointed you to a good resource, but basically you've hit Context. In Perl, when you:
- Do a mathsy thing to a string (like '0E0' or 'oink' or '57Fred')
- Any digits at the start are taken as the value and the rest is lost. So (5 + '0E0') == (5 + '0') == (5 + 0) == 5
- Do a stringy thing to a string
- It stays the way it is
- Do a neutral thing to a string, like checking for truth
- It again gets left the way it is.
So in your case, '0E0' is true
as a string, because it's neither empty nor just the string '0', but false
as a number because it gets whittled down to the value 0 (the digits at the start).