use overload '0+' => sub { ${$_[0]} }, '""' => sub { ${$_[0]} ? "true" : "false"}, '!' => sub { ${$_[0]} ? $false : $true }, fallback => 1; #### use boolean; $\ = $/; my $false = false; print "\$false is $false" unless $false; my $copy = $false; print '$copy is also false' if not $copy; my $str_false = "$false"; print '$str_false is true?' if $str_false; print 'But equal to false' if $str_false eq $false; my $true = true; my $str_true = "$true"; print '$str_true is true but != from true' if $str_true and ($str_true != true); print "The value of this test is: ", boolean(true||false); #### $false is false $copy is also false $str_false is true? But equal to false $str_true is true but != from true The value of this test is: true