... $name_hash{uc $username} = $password; ... while() { chomp; exit if $_ eq 'exit'; my $name = uc $_; if (exists $name_hash{$name}) { print "The password for $name is $name_hash{$name}, please enter another name to search\n"; } else { print "I'm sorry, there is no one here by that name, please try another name or type exit to end.\n"; } }