in reply to RE: RE: Sorting search results in PERL
in thread Sorting search results in PERL

Well, something is still amiss in the information you're providing. There's no sample dataset to see exactly what's going, so I made some up. The code sorts the data as I would expect, although the print statement makes no use of any of the $field_x variables that you have created.

I've commented out the print portion, since it produces no output relevant to your question. As you can see, the basic sort and printing for the variables you created works as one would expect.

I would assert that you are not using 'use strict' and -w in your script, which will cause you endless grief, the scorn of your ancestors, and a generally low karma value. Try adding them, clean the resulting errors up, and see if that helps a little.
#!/usr/local/bin/perl -w use strict; my @results = (qw(Z|a|b B|c|d H|e|f I|g|h K|i|j M|k|l E|m|n U|o|p P|q| +r Q|s|t A|u|v)); my @sorted = sort {uc($a) cmp uc($b)} @results; foreach my $sorted (@sorted) { my ($field_1, $field_2, $field_3) = split(/\|/,$sorted); print "$field_1, $field_2, $field_3\n"; # my $user = 'arf'; # my $razao_social = 'spot'; # print<<feach; # <tr> # <td bgcolor="#C0C0C0" colspan="2"> # <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> # <a href="/relatorios/$user/$razao_social.data" target="_top +">$razao_social</a> # </font> # </td> # </tr> #feach }

A, u, v B, c, d E, m, n H, e, f I, g, h K, i, j M, k, l P, q, r Q, s, t U, o, p Z, a, b


--Chris

e-mail jcwren