in reply to Re^2: Sort by distance
in thread Sort by distance
Well, you eliminated too much: The example above doesn't have enough information to answer your question.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Sort by distance
by pglinx (Acolyte) on May 27, 2009 at 14:53 UTC | |
| [reply] [d/l] |
by DStaal (Chaplain) on May 27, 2009 at 16:21 UTC | |
Ok, I don't see any sort in there. What's your plan for sorting things? For that matter, where are the two arrays you were using in your initial post? I don't see either of them here. You are probably going to need some data structure that relates things together (a hash, of some sort), which would then be in an array for each line, which you can then sort and use. | [reply] |
by Marshall (Canon) on May 28, 2009 at 00:14 UTC | |
I also still don't see the sort problem yet. UPDATE:
I looked back again this question. The value distance in km is a derived value from the input data. So to get the printout to come out in a different order than the order provided by the DB in the loop, you need to save the data for each print, then sort that data structure, then print it. You have a lot of values, less than probably you create in the split, but still a lot. So, one choice for the data structure is a LoH (list of hash), some folks would say AoH (Array of Hash). This allows you to have nice names that can be used later when doing the print. Try something like this:
| [reply] [d/l] [select] |