I am fetching two columns from oracle DB using the DBD::Oracle module. this is my code whihc Actually fetches the output:
my $sth = $dbh->prepare($query);
while ( my $row_ref = $sth->fetchrow_arrayref )
my $vm = $row_ref->;
my @nfs = split (/:/, $row_ref->);
my $filer = $nfs;
print "$vm, $filer, \n";
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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] |