in reply to WitchTest - A Tool For Determining If A Woman Is Guilty Of Witchcraft
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: WitchTest - A Tool For Determining If A Woman Is Guilty Of Witchcraft
by JavaFan (Canon) on Jul 02, 2009 at 09:47 UTC | |
by ikegami (Patriarch) on Jul 02, 2009 at 15:31 UTC | |
|
Re^2: WitchTest - A Tool For Determining If A Woman Is Guilty Of Witchcraft
by ysth (Canon) on Jul 02, 2009 at 01:43 UTC |