Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Uniq and sort in perl

by Utilitarian (Vicar)
on Jul 12, 2012 at 15:24 UTC ( #981424=note: print w/ replies, xml ) Need Help??


in reply to Re: Uniq and sort in perl
in thread Uniq and sort in perl

This is a very valid point, selecting only the fields you are interested in would improve performance as well as being the "correct" way to achieve this

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."


Comment on Re^2: Uniq and sort in perl
Download Code
Re^3: Uniq and sort in perl
by slayedbylucifer (Scribe) on Jul 12, 2012 at 16:58 UTC
    No. the SQL query is not giving me the duplicate entries. They look duplicate only after I run the "split" function inside my while loop. Thanks for your time.
      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.

      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.

      CountZero

      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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://981424]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-11-28 15:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (198 votes), past polls