Clear questions and runnable code
get the best and fastest answer
What is the correct definition of False and Null in Perl?by flexvault (Parson)
|on Oct 07, 2011 at 20:38 UTC||Need Help??|
flexvault has asked for the
wisdom of the Perl Monks concerning the following question:
I recently was surprised that a ascii '0' was interpreted by an if statement as 'FALSE'. I have thought about this alot, and wonder if this really the way it should be.
The following script shows what I'm talking about.
The script produces:
The first 4 and the last 3 lines I agree with, but the lines in the middle I have a problem with.
I checked several of my perl books and it seems:
But then in "Programming Perl" Glossary is states 'false In Perl, any value that would look like "" or "0"...' but this disagrees with the definition on page 7.
Am I missing something or has it just been too long of a perl week?
"Well done is better than well said." - Benjamin Franklin