in reply to Re^5: Tie::Hash::MultiValue Unique question
in thread Tie::Hash::MultiValue Unique question

Ahh Yes! Thanks for someone still making sense out of my
pitifully worded question!
The point is that I want to avoid duplicates in values, not keys.
When googled this bit, I found out I could use Tie::Hash::Multivalue
for ensuring I can add multiple values
to a key in the hash, and I can pass an argument
'Unique' to ensure that only unique values get added.
So that was my original question - how do I pass the argument
"unique" to Tie::Hash::Multivalue?

Thanks all for responding!
  • Comment on Re^6: Tie::Hash::MultiValue Unique question

Replies are listed 'Best First'.
Re^7: Tie::Hash::MultiValue Unique question
by ikegami (Patriarch) on Apr 18, 2009 at 18:54 UTC
    # Uses string compare to determine uniqueness. tie %hash, 'Tie::Hash::MultiValue', 'unique'; # Uses numerical compare to determine uniqueness. tie %hash, 'Tie::Hash::MultiValue', unique => sub { $_[0] == $_[1] };
      Thanks Much!