my $people = 10; my $prizes = 8; my $draws = 22*2; #### our $people = (shift or 10); our $prizes = (shift or 8); our $draws = (shift or 22*2); #### our $people = 10; our $prizes = 8; our $draws = 22*2; my @save_args; while (@ARGV) { if ($ARGV[0] eq '-people') { shift @ARGV; if (@ARGV) { my $temp = shift @ARGV; if (($temp > 0) and ($temp < 1e6)) { $people = $temp; } else { die "Error: -people out of range, <$temp>, " } } else { die "Error: -people, no value, " } next; } # etc. } #### use Getopt::Declare; our $PEOPLE_OPT = '-p'; our $PRIZES_OPT = '-z'; our $DRAWS_OPT = '-d'; our $PEOPLE_DEFAULT = 10; our $PRIZES_DEFAULT = 8; our $DRAWS_DEFAULT = 22*2; our $people = $PEOPLE_DEFAULT; our $prizes = $PRIZES_DEFAULT; our $draws = $DRAWS_DEFAULT; my $option_spec = qq{ $0 does some magic for BS Bingo, yada, yada, yada Options: $PEOPLE_OPT Sets number of people (default is $PEOPLE_DEFAULT) { reject ($people < 2) or ($people > 1e6); \$::people = $people; } $PRIZES_OPT Sets number of prizes (default is $PRIZES_DEFAULT) { reject ($prizes < 2) or ($prizes > 1e6); \$::prizes = $prizes ; } $DRAWS_OPT Sets number of draws (default is $DRAWS_DEFAULT) { reject ($draws < 2) or ($draws > 1e6); \$::draws = $draws ; } } my $options = Getopt::Declare->new( $option_spec ) or die "\n**** Error processing command line options, terminating $0\n"; #### for (0..($draws-1)){ local $_ = $seq[$_]; #### for (@seq[0..$draws-1]){ #### for my $draw (@seq[0..$draws-1]){ #### my $winstring = $b[$j].' '.$i[$j].' '.$n[$j].' + '.$g[$j].' '.$o[$j]."\n"; #### my $winstring = "$b[$j] $i[$j] $n[$j] $g[$j] $o[$j]\n"; #### sub getRand(){ while (1){ my $temp = int(1111*rand()/11); unless ($temp = 0) {return $temp; exit} } } #### my $temp = int(rand(100)+1; #### {return $temp; exit} #### &doInit; &mkCards; #### doInit(); mkCards(); #### $status = getRand + 17; #### if (m,([01]{10})\n((?:(?:\w\-\d+[\s\n]){5}){5} +),) #### local *getNewDrawBall = sub { #workaround for +scoping inner subroutine with typeglob - ugly Per +lism my $type = shift; my $temp2; while (1){ $temp2 = &getDrawBall($type); if (exists $seen{$temp2}) { next; }else{ $seen{$temp2}++;return $temp2;} #pr +int "DEBUGdraw: $temp\n"; } }; #### { # closure for getNewDrawBall, getNewNonDrawBall my %seen; sub clearNewDrawBallCache { %seen = (); } sub getNewDrawBall { # stuff here } sub getNewNonDrawBall { # stuff here } } # end closure for getNewDrawBall, getNewNonDrawBall #### for my $k (1..$losers) { my $linestring; my $count = 0; clearNewDrawBallCache(); #SPOIL CARD HERE # etc... } #### local *coinFlip = sub { my $z = &getRand; my $coin = int($z)% 2; return $coin; };