Hi Devo, and welcome to PerlMonks.
I think that your specific question can be answered by reading more about sort and reverse. I suspect that your problem is not limited to the title of this node.(Descending Sort)
More generally, here are some obserations about your code.
my $adata = q(athings1 athings2); my $bdata = q(bthings1 bthings2); my $column = 0; # ... sort_func($column,$adata,$bdata); sub sort_func { my ($sortby,$astring,$bstring) = @_; # this function uses three arguments. }
if ($sortby eq "string"){ my $result = sort { $b cmp $a } ($a_items[$item_no], $b_items[$item +_no]); } # $result will contain the greater of the two values.
my @a_items = split("\t", $astring,$limit); #store the remainder my $a_remainder = pop @a_items; my @b_items = split("\t", $bstring,$limit); #discard the remainder pop @b_items;
I hope this isn't over-doing the answer (a lot of guessing at your intent) but, it appears that some of these observations might be relevant to why you aren't getting the result that you want.
mkmcconn
In reply to Re: Descending Sort
by mkmcconn
in thread Descending Sort
by Devo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |