**UNTESTED **foreach my $keys (keys(%hash)) { my $races = $hash{$keys}; # For easy access to @$races + ... my $choice = "INVALID"; while (not ( $choice=~/^\d+$/ and defined $races->[$c +hoice -1])){ print ($_ +1) . " . " . $races->[$_] . "\n" for 0.. +$#$races; print "\nGive me your choice..\n"; chomp ( $choice = <STDIN>); } ....
What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
-Larry Wall, 1992
In reply to Re: how to add conditionals to hash and stdin.
by NetWallah
in thread how to add conditionals to hash and stdin.
by Jabox
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |