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?

Yes.

foreach my $intersect_file(@intersect_keys) { my $exec = $system_file_data{$intersect_file}; my @values = ref $exec ? @$exec : ($exec); print "$_\n" for @values; }

See perlreftut and perldsc for more information about nested structures.

Replies are listed 'Best First'.
Re^6: Need to get the intersect of hashes
by wade (Pilgrim) on May 15, 2008 at 16:18 UTC

    It seems to me that it makes more sense to have every hash element contain a reference to an array instead of having an array reference in some elements and values in others. That makes your code a _lot_ easier. No checking every time you access it, no do this in some cases/do that in other cases.

    --
    Wade