in reply to Re^2: Compare usernamesin thread Compare usernames
See perlfaq4 for "duplicate". That shows the basic approach of removing duplicates from any kind of list.
Adapting this algorithm to your specific needs is left as an exercise.