my $username = "$lname, $fname"; %new_hash; $new_hash{$username} = $password; while() { print "Please enter a last name and a frist name.\n"; chomp ($input =<STDIN>); { foreach ($input) { if (exists $new_hash{$username}) { print "The username is $username and the password is $new_hash +{$username}\n"; last; } else { print "I'm sorry, there is no one here by that name!\n"; last; } }
In reply to Search a hash for STDIN and report findings by trenchwar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |