use strict; use warnings ; foreach my $z ('0', '0000', '+0', '-0', ' 0', '0 ', '0E0') { try($z) ; } ; sub try { my ($z) = @_ ; my $bool = $z ? 'True' : 'False' ; my $zero = $z == 0 ? '==' : '!=' ; printf "%7s is %5s and %2s 0\n", "'$z'", $bool, $zero ; } ;