|Perl: the Markov chain saw|
Re: Simple Blackjack progam helpby moritz (Cardinal)
|on Oct 13, 2012 at 17:48 UTC||Need Help??|
First of all, please start your code with
and declare your variables with my when you use them first.
Some others errors I noticed at first glance:
When you read in a line with $variable = <STDIN>, then the variables has a trailing newline character. Usually you don't need that, so remove it by calling chomp $variable.
== is for comparing numbers, but 'y' isn't a number. Instead use
Your draw subroutine already calls int, there's no need to do it twice
That returns an integer between 0 and 9, not between 1 and 10.
Please search a bit for debugging tips & tricks here on perlmonks, there a quite a few that could have caught many of these errors, and probably many other errors that still lurk in your code.