in reply to Perl Program w/ Hash
To learn more about accessing hashes, see Perl variable types in perlintro.%friends= ("Bill" => "313-333-5555", "Bob" => "313-777-98755", "Joe" => "313-555-4435", ); print "Which phone number do you want?\n"; $name = <STDIN>; chomp $name; # To remove trailing newline print $friends{$name};
|
|---|