#!/usr/bin/perl -w
%words = qw(
ray camel
john llama
bill alpaca
mike alpaca
);
print "What is your name? ";
$name = <STDIN>;
chomp $name;
$original_name = $name;
$name =~ s/\W.*//;
$name =~ tr/A-Z/a-z/;
if ($name eq "aaron")
{
print "Hello, Aaron. How good of you to join me.\n";
}
else
{
print "Hello $original_name.\n";
$secretword = $words{$name};
if($secretword eq ""){
$secretword = "groucho";
}
print "What is the secret word? ";
$guess = <stdin>;
chomp $guess;
while ($guess ne $secretword)
{
print "Wrong try again. What is the secret word? ";
$guess = <stdin>;
chomp $guess;
}
}