Uniq and sort in perlby slayedbylucifer (Scribe)
|on Jul 12, 2012 at 08:43 UTC||Need Help??|
slayedbylucifer has asked for the
wisdom of the Perl Monks concerning the following question:
I am fetching two columns from oracle DB using the DBD::Oracle module. this is my code whihc Actually fetches the output:
I have omitted rest of the code but above while loop should get you the idea what I am trying to do. "$query" value was given to me by the Oracle DBA and it is fairly complicated as it does quite a few comparisons. BTW, i dont udnertand how that query is wirtten. Anyway, it fetcehs the information that I need.
The problem is, the output of above "while" loop gives me few duplicate entries as below:
Pelase note that the Query statement has the "unique" function running. But after I run the "split" command in while loop, I get above few duplicate entries.
So, How to sort these entries and make them unique. I mean above, above duplicate entries should look like below:
please guide me on a technique which can be used in above "while" Loop. In bash, it is fairly simple to run ...| sort | uniq . but I could not find a way in perl to do the same