fork download
  1. use warnings;
  2. use strict;
  3.  
  4. use B;
  5.  
  6. sub is_bool {
  7. my $arg = shift;
  8. return !!1 if (B::svref_2object(\$arg)->FLAGS == 292614);
  9. return !!0;
  10. }
  11.  
  12. my $yes = !!1;
  13. my $no = !!0;
  14. print "\$yes is boolean true!\n" if ($yes && is_bool $yes);
  15. print "\$no is boolean false!\n" if (!$no && is_bool $yes);
Success #stdin #stdout 0s 5056KB
stdin
Standard input is empty
stdout
$yes is boolean true!
$no is boolean false!