Hey Monks:
My (free) provider disabled all CGI (Perl included) b/c some geek hacker attacked in a very malicious way. As such, I had to recode everything in PHP. What a crime, no? Anyways, as I'm out of practice, I'm having trouble with something.
I need to loop through a small hash. Some of the keys are the same though. Seems that everything I try such as either of two of the following won't work. It will grab only one instance in which a key is used, or both instances, but output the same value twice.
Any help?
my %hash = (
"bob" => "section-a",
"bob" => "section-b",
);
for my $key ( keys %hash ) {
my $value = $shit{$key};
print "$key => $value\n";
}
Returns bob => section-a
my %hash = (
"bob" => "section-a",
"bob" => "section-b",
);
for ( my ( $key, $value ) = each %hash ) {
print "$key => $value\n";
}
Returns
bob => section-b
bob => section-b