![]() |
|
The stupid question is the question not asked | |
PerlMonks |
Re: What is true and false in Perl?by tobyink (Canon) |
on Apr 16, 2012 at 16:37 UTC ( #965353=note: print w/replies, xml ) | Need Help?? |
The oft-cited list of values considered false is:
I did actually manage to find another value that Perl treats as false:
You can see its interesting behaviour here:
Note that it's false but not (stringy) equal to zero. This does vary between Perl versions. The behaviour documented above exists between Perl 5.6.x to 5.12.x (obviously you need to use print instead of say before Perl 5.10) and perhaps earlier. But in Perl 5.14.x, -0.0 is (stringy) equal to 0.
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
In Section
Tutorials
|
|