trenchwar has asked for the wisdom of the Perl Monks concerning the following question:
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; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Search a hash for STDIN and report findings
by moritz (Cardinal) on Feb 06, 2008 at 22:36 UTC | |
by trenchwar (Beadle) on Feb 07, 2008 at 18:51 UTC | |
by moritz (Cardinal) on Feb 07, 2008 at 19:37 UTC | |
by toolic (Bishop) on Feb 07, 2008 at 19:46 UTC | |
by moritz (Cardinal) on Feb 07, 2008 at 21:08 UTC | |
| |
by trenchwar (Beadle) on Feb 07, 2008 at 21:09 UTC |