I don't know why there is an error. It tells me "Use of uninitialized value at test.pl line 16, <STDIN> chunk 1." 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); } }
In reply to HElp on program by alvarr3
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |