in reply to Re: Return reference to hash keys
in thread Return reference to hash keys

Thanks! That is exactly what I needed. I didn't know the difference between a LIST and an ARRAY. I guess I still need to learn about it, but your solution for an anonymous array reference is exactly what I was looking for.

Thanks a million.

Here is my final code, for what it is worth. Yes, I needed to reinvent the wheel for portability, since getting List::MoreUtils is not an option...
sub compare { my @refs = @_; my ($all, $inter, $diff); my %files; foreach my $ref (@refs) { foreach (@$ref) { $files{$_}++; } } $all = [ keys %files ]; foreach my $e (@$all) { push @{ $files{$e} > 1 ? $inter : $diff }, $e; } return ($all, $inter, $diff); }

Replies are listed 'Best First'.
Re^3: Return reference to hash keys
by kennethk (Abbot) on Nov 30, 2010 at 21:14 UTC
    The difference between a list and an array is discussed a bit in perldata. The short, oversimplified version of it is that lists are values and arrays are variables.

    Regarding not using List::MoreUtils, Yes, even you can use CPAN should have an on-point discussion for consideration.