in reply to "Biochem BINGO" or "Noob Seeks Zen Thrashing"

My only suggestion, since I knew I wouldn't be able to handle reading through this, is to clean up your code. Make it look nice. That may sound very picky and worthless, but really it is very helpful for anyone trying to understand your code.

This may seem kinda stupid, and I can't really explain why I have this preference - maybe it's for general aesthetic appeal, which frankly is important to my stress levels when maintaining code - but drop the long lines of pound signs/comment signifiers/whatever you want to call em.

# USER VARIABLES # define number of people, number of prizes, number of draws (> 5) my $people = 10; my $prizes = 8; my $draws = 22*2; # define total set of BINGO numbers # range of numbers my $range = 75; # INTERNAL/DEVELOPMENT VARIABLES my $bin = int $range/5; my @bins = ($bin, 2*$bin, 3*$bin, 4*$bin); #my @seq = @fudgedDrawSeq; my (@callseq, @noncallseq); #auxillary lists to build my @winstring; # MAIN EXECUTION 1 # * this part used to define metadata; cards outputed from metadata # * this metadata needed so Matt can have the draw sequence now. # my %ball; #hash containing $range BINGO balls THIS SHOULDN'T BE HERE # my @drawSeq; #for &defDrawSeq, draw sequence ... # for ($draws..($range-1)){push( @noncallseq, $seq[$_] ); print "$seq[ +$_], ";} # &mkWinstring; # unless (&chkWinstring){die "\nplease rerun, internal randomization e +r +ror"} # &mkCards; # FUNCTIONS 1 sub ...

Try to put one comment at the beginning of a 'block' of code, and seperate these blocks with an empty line. And if you consistently put all of your subs at the end of your files (like it looks like you do), then people will see your first sub declaration and assume that the rest of the file is subs. So you probably don't even need to denote that with a # FUNCTIONS 1 comment.

And then in your second piece of code, try this. I didn't change any of your code, I just added indents, and put newlines in places. It immediately made the code a lot more understandable. For one, I didn't even realize there was a while block on the first glance, but after showing the blocks better, it's more obvious that these are looping until they return. Also, after indenting and putting things on seperate lines, I realized that you try to print after you return from the sub.

sub getRand { my $temp; while (1) { $temp = int(1111*rand()/11); unless ($temp == 0) { return $temp } } }; sub getDrawBall { my $type = shift; while (1) { my $temp = pop @callseq; unshift( @callseq, $temp ); if ($temp =~ /$type/) { return $temp; print "DEBUG getDrawBall: $temp\n"; } } } sub getNonDrawBall { my $type = shift; while (1){ my $temp = pop @noncallseq; unshift( @noncallseq, $temp ); #print "sNDB\:\: TEMP $temp TYP +E $type\n"; if ($temp =~ /$type/) { return $temp; print "DEBUG getnonDrawBall: $temp\n"; } } }

I guess the point I'm trying to make is try to keep your code clean and looking nice. You'll find it does wonders.

    -Bryan