in reply to Loop Control : REDO
It works then but allows letters... maybe wrap it in an int()?
Update Wrapping it in an int makes letter entries zero, maybe instead of chomp do
then you just get the numbers.#!/prod/gnu/bin/perl print "** Random 4 Lotto Numbers **\n"; print "** Type any four digits (0 to 9) **\n\n"; for ($i=1; $i <= 4; $i++) { print "Choice $i: "; ($digit[$i] = <>) =~ s/\D//g; redo unless $digit[$i]; redo if $digit[$i] > 9; redo if $digit[$i] < 0; } print "Your choices :@digit \n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Loop Control : REDO
by skullbowl (Monk) on May 02, 2001 at 17:54 UTC | |
|
Re: Re: Loop Control : REDO
by iakobski (Pilgrim) on May 02, 2001 at 18:18 UTC | |
by merlyn (Sage) on May 02, 2001 at 18:23 UTC | |
by suaveant (Parson) on May 02, 2001 at 18:31 UTC | |
by suaveant (Parson) on May 02, 2001 at 18:35 UTC | |
by iakobski (Pilgrim) on May 02, 2001 at 18:45 UTC | |
by suaveant (Parson) on May 02, 2001 at 18:52 UTC |