Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I'm putting together a web page table, and using it (among other things) as a chance to learn some perl. I'd like to provide the user with sort-by-column functionality.
The data set isn't big enough to warrant a real database behind the scenes, but it's also big enough to make client-side JavaScript sorting questionable. (Tendancy to "hang" while it sorts, at least if a page is reloading the user knows something is happening) The obvious language-independant server-side approach here is to load the entire dataset into a 2D array, sort, and iterate through the first dimension while printing table rows. This seemed like a straightforward task, perl provides a sort function that accepts a sub to compare (sort) with. Loading the data into a list of lists is easy enough, however, I'm a little confused regarding how the reference syntax would work in this sort sub. This seems like a common type of task, sorting by something other than the first index in a list of lists, does anyone have a solution they're particularly proud of? In reply to Non-DB table sorting by Xaositect
|
|