I tested your program at my site and it works:
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?
|