On Wed, Jul 9, 2014 at 6:59 PM, SSC_perl <[email protected]> wrote:
> If someone could explain what I'm doing wrong, I'd appreciate it. I
> just can't see it.
You're looping over the entries in the array, not the entries in the hash.
> foreach my $state (sort keys %entries) {
> say "The Zip Codes of $state are";
> foreach (@{$entries{$state}}) {
This foreach loop is looping over the five zip codes in the array...
> print Dumper (@{$entries{$state}});
And printing out the same array each time.
Try something like
foreach my $state ( sort keys %entries) {
say "The ZIP codes of $state are: ";
foreach my $zip ( @{ $entries{$state} } ) {
say "\t$zip";
}
}
j.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/