in reply to Removing duplicate hashrefs from an array
Having said that, and keeping in mind that I've never used smart match for anything but just quickly testing it out of curiosity, I would think that comparing an array with an hash ref (i.e. a scalar containing a reference to an hash) is probably unlikely to work. Maybe you would need to dereference the hashref before using it. But I may be completely wrong on that. An additional consideration is that your hash or hashref should be declared before entering the foreach loop.
Anyway, given the experimental nature of the smart match, using a hash or a hash of hashes (depending on what type of uniqueness you exactly need) in the traditional idiomatic Perl way is likely to be a more robust and lasting solution.
|
|---|