public
Created

  • Download Gist
gistfile1.perl
Perl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/usr/bin/perl
use strict;
 
{
package Booloney;
sub new { bless { i => 0 } }
use overload '!' => sub { my $i = (++$_[0]{i}); sqrt $i == int sqrt $i },
fallback => 1;
}
 
my $x = Booloney->new;
for (1 .. 10) {
my $bool = ! $x;
printf "%s <- %20s \$x\n",
($bool ? 'T' : 'F' ),
join(' ', ('!') x $_);
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.