Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Re: Link sort order in categorys

Quote Reply
Re: Link sort order in categorys In reply to
No it isn't. Pearl uses the the ASCII comparison as the standard sort method in its function sort().

the sub build_sort_links uses this line of code to merge and sort the two arrays:

my @c = sort { lc join ("", @{$a}[@fields]) cmp lc join ("", @{$b}[@fields]) } @{$arr_b}, @{$arr_a};

where the sort criteria is in the array @fields (Rating, Hits, Votes)

To force the sort routine to sort numeric it has to be called this way:

@sorted= sort {$a <=> $b} @unsorted;

Is there anybody out there who can translate the first line of code and modify it to the numeric sort?

regards, alexander

Subject Author Views Date
Thread Link sort order in categorys Alex404 3405 Jun 2, 2000, 1:18 PM
Thread Re: Link sort order in categorys
pugdog 3323 Jun 2, 2000, 8:15 PM
Thread Re: Link sort order in categorys
Alex404 3291 Jun 5, 2000, 6:59 AM
Post Re: Link sort order in categorys
pugdog 3289 Jun 7, 2000, 6:02 AM
Thread Re: Link sort order in categorys
pugdog 3275 Jun 7, 2000, 6:07 AM
Thread Re: Link sort order in categorys
Robert 3286 Jun 7, 2000, 7:23 AM
Post Re: Link sort order in categorys
pugdog 3268 Jun 7, 2000, 10:08 PM