The recordset you retrieve indeed will not contain duplicate records, but that is only because you retrieve more fields and data than you use in your final results.
in reply to Re^3: Uniq and sort in perl
in thread Uniq and sort in perl
You do nothing with the second field and you discard all the data after the first ":" delimiter in the third field. And perhaps there are many other fields you do not use at all.
Try to rewrite your SQL so it only gives you exactly what you need.
If that is not possible, then perhaps you should revise your database scheme. If you regularly need the dotted quad as a result, then perhaps that should be a separate field (rather than hidden inside another field) so you can index it and increase the retrieval speed many times.
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial Deltronics