in reply to Remove unique elements from a list of lists

If I understand correctly, you want the list of elements common to all, right?. There is a fairly simple way to do that.

The list must be a subset of any row, so start with the first and make a hash of it, called %common. Look at the next row, and delete any key in %common which is not there. Lather, rinse repeat. Here's the code:

sub common { my $num = @_; my (%common, %test); $_ = shift; @common{@$_} = () x @$_; # second use is scalar context while ( $_ = shift) { %test = (); @test{@$_} = () x @$_; delete @common{ grep { ! exists $test{$_} } keys %common}; } [ [keys %common] x $num ]; }
delete takes a list of arguments, which is provided by the slice over %common. The keys for that slicee are selected by grep as those which are not present in the current array, as represented by keys %test.

This approach discards ordering.

Update: Modified code to return ref to AoA corresponding to $test of the root node. U2 fixed typo in code, parens for curlies in %common init, may save some time.

After Compline,
Zaxo