Last active
March 4, 2019 04:08
-
-
Save worthmine/f51a5c693362ca7c9dd4aea64f73ebb4 to your computer and use it in GitHub Desktop.
What is false in Perl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use feature qw(say); | |
use warnings; | |
my $false = !1; | |
say defined $false; # 1 | |
say '----'; | |
say '!1 is false' unless $false; # !1 is false | |
say '0 is false' unless 0; # 0 is false | |
say '0.00 is false' unless 0.00; # 0.00 is false | |
say '0x0 is false' unless 0x0; # 0x0 is false | |
say '0e0 is false' unless 0e0; # 0e0 is false | |
say '"0" is false' unless "0"; # "0" is false | |
say '3-2-1 is false' unless 3-2-1; # 3-2-1 is false | |
say 'sin(0) is false' unless sin(0); # sin(0) is false | |
say '"0" is false' unless "0"; # "0" is false | |
say '"0.00" is false' unless "0.00"; # returns nothing | |
say '0x0 is false' unless "0x0"; # returns nothing | |
say '0e0 is false' unless "0e0"; # returns nothing | |
say '3-2-1 is false' unless '3-2-1'; # returns nothing | |
say 'sin(0) is false' unless 'sin(0)'; # returns nothing | |
say '"" is false' unless ""; # "" is false | |
say '() is false' unless( () ); # () is false | |
say 'undef is false' unless undef; # undef is false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment