As GotToBTru said, your code isn't very useful without sample data.
But if I have understood your problem well, there is one obvious solution. Uniqueness means hash:
The hardest part of the job is to find a way to stringify the pair in a way that is actually unique, it can be by using an invalid character as a separator, or using pack for prepending the size of the first string, or whatever works.sub existsPair { our %pairs; my (@pair) = sort @_; local $" = "~~"; # Only works as long as ~~ can't appear in one of t +he inputs values return $pairs{"@pair"}++; } existsPair "Hello", "World"; # false existsPair "Hello", "World"; # true existsPair "World", "Hello"; # true existsPair "He", "lloWorld"; # false
In reply to Re: writing array as pairwise
by Eily
in thread writing array as pairwise
by AWallBuilder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |