in reply to Re^4: Need to get the intersect of hashes
in thread Need to get the intersect of hashes
Could the problem be that I have more than one value in some of the keys?
No, because it's impossible for a hash to have more (or less) than one value per key. Your values are references to arrays. The referenced arrays may containing any number of values, but the values of your hash are simply references.
Once you fetch the reference, you may iterate over the referenced array:
foreach my $intersect_file (@intersect_keys) { my $execs = $system_file_data{$intersect_file}; # Array ref foreach my $exec (@$exec) { print("$exec\n"); } }
It could also be written as the following, but I prefer the former:
foreach my $intersect_file (@intersect_keys) { foreach my $exec (@{ $system_file_data{$intersect_file} }) { print("$exec\n"); } }
|
|---|