use strict; use warnings; use File::Basename qw( basename ); sub usage { my $prog = basename($0); print(STDERR "usage: $prog suspect\n"); exit(1); } sub witch_test { my ($suspect) = @_; return 1 if $suspect->float(); return 0; } my ($suspect) = @ARGV or usage(); my $is_alive = ($is_witch) = eval { witch_test($suspect) ?1:0 }; if ($is_witch) { if ($is_alive) { print("Burn her!\n"); } else { print("God's will has been carried out\n"); } } else { if ($is_alive) { die("Assertion error: Need better witch test\n"); } else { print("What a *cough*tragedy*cough*\n"); } }
Update: Fixed negated logic mentioned by JavaFan
In reply to Re: WitchTest - A Tool For Determining If A Woman Is Guilty Of Witchcraft
by ikegami
in thread WitchTest - A Tool For Determining If A Woman Is Guilty Of Witchcraft
by bpoag
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |