use warnings; use strict; my %games = ( good => [ "nfs", "nfsII", "With the PerlMonks", "Morrowind", "TES Constructor Set" ], bad => [ "RedFactionII", "CCG", "RavenShield", "AGG" ], ); # another way to loop my $mood = ''; while( ! exists $games{$mood} ) { print "How has your day been?\n"; $mood = ; chomp $mood; $mood = lc $mood; } my $game_aref = $games{$mood}; my $randgame = ${ $game_aref }[ rand @{ $game_aref } ]; print "You should play: $randgame\n"; #### my %games = ( good => [ "nfs", "nfsII", "With the PerlMonks", "Morrowind", "TES Constructor Set" ], bad => [ "RedFactionII", "CCG", "RavenShield", "AGG" ], fantastic => [ "With the PerlMonks" ], );