this is my hash below:
my %dept_and_names = ("Accounting", "John Montgomery",
"Customer Service", "Carol Jefferson",
"Customer Service", "Jill Paulo",
"Research and Development", "Jeffrey Johnson",
"Accounting", "Sam Rantini",
"Payroll", "Susan Choi",
"Research and Development", "LaChonda Washington",
"Customer Service", "Nancy Smith");
can someone please suggest a simple way of displaying all of my unique
hash values. For example: I want to display all the names (values) that
have the "Accounting" key, or all the names that have the "Payroll" key.
this is my script below but it only displays the name (value) for each
unique key.
foreach my $key (keys(%dept_and_names)) {
print "$key: $dept_and_names{$key}\n"
}
with this script my results would be:
Accounting: Sam Rantini
Research and Development: LaChonda Washington
Customer Service: Namcy Smith
Payroll: Susan Choi
But I want all the Accounting, Research and Development, Customer
Service, and Payroll key and values listed not just each unique key
listed only one time.
help
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>