You're going to run into problems with non-scalar items, such as objects and hashrefs and listrefs. This is why you want to use a CPAN module. This is also true with the idiomatic (but wrong) unique'ing function that uses a hash. Much better is to use the uniq() function from List::MoreUtils which has been fixed to handle these issues.
in reply to Idiom: hashes as sets
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?