Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Wouldn't this fail if the same element appears mulitple times in an array, such that the number of times it appears overall is == num of arrays? This code assumes all elements are unique in each array. The provided code does not make that assumption. The key lines are: If the array in $ids{$k} has a whole bunch of 1s in it, that's okay, we'll overwrite $uniq{1} a whole bunch of times. Because hash keys must be unique. This means that at the last statement in this loop %uniq will represent a hash with only the unique values from $ids{$k} I hope this helps. jarich In reply to Re^3: intersection of N arrays
by jarich
|
|