alvarr3 has asked for the wisdom of the Perl Monks concerning the following question:
Help please! alvarr3@words=qw( fred camel barney llama betty alpaca wilma alpaca ); print "What is your name?\n"; $name=<STDIN>; chomp ($name); if ($name eq "Randal") { print "Hello, Randal! Welcome!\n" } else { print "Hello $name.\n"; $secretword=$words{$name}; # use {} for hash if ($secretword eq ""){ # gives me an error around here $secretword="stupid"; #default secret word } print "What is the secret word?"; $guess =<STDIN>; chomp($guess); while ($guess ne $secretword){ print "Wrong, try again.\n"; $guess=<STDIN>; chomp ($guess); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Newbie needs help
by chumley (Sexton) on Mar 25, 2001 at 10:24 UTC | |
by greenFox (Vicar) on Mar 26, 2001 at 08:41 UTC | |
|
Re: NEwbie needs help
by Hero Zzyzzx (Curate) on Mar 25, 2001 at 10:46 UTC |