Subject: | Wishlist: is_uniq and assert_uniq |
Sometimes you want to make sure an array has no duplicate values. One way is
scalar(@items) == scalar(uniq(@items))
It would be handy to have
is_uniq(@items)
Very often you just want to die on duplicate values. In that case an assert_uniq() routine is handy and it's also able to give a good error message.
assert_uniq(@items)
It would die with a message like
List expected to contain unique values, but the value "xyz" appears more than once