use strict; use CGI qw(:standard); print header; print start_html("Hash Test"); my %HoL_compare_pub=('NL','The Netherlands','BE','Belgium','DE','Germa +ny','MC','Monaco','ES','Spain'); my %HoL_pub=('NL','The Netherlands','BE','Belgium'); my %no_matches; foreach my $key (keys %HoL_compare_pub) { push @{$no_matches{$key}}, $HoL_compare_pub{$key} unless exists $HoL_pub{$key}; } foreach my $noMatchKey (keys %no_matches){ print "$noMatchKey\n"; } print end_html;
What I don't understand is why you describe $no_matches{$key} as being an array-ref. It seems to me that it is simply an element of a hash.
$no_matches{$key) does not seem to refer to anything outside of %no_matches. So why is it an array-ref?
In reply to Re: (dkubb) Re: (2) Comparing contents of 2 Hash of Arrays
by sierrathedog04
in thread Comaring contents of 2 Hash of Arrays
by Tuna
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |