Rob Dixon - Re: sorting thoughts

2003-02-02 Thread Steven_Massey
Dixon" <[EMAIL PROTECTED] To: [EMAIL PROTECTED] am.co.uk>cc: Subject: Re:

Re: sorting thoughts

2003-01-30 Thread Rob Dixon
"Steven Massey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] m... > > If you could explain how this works, especially how $a $b are set with the > compare values > > my @sorted = sort { > (split ':', $a)[-1] <=> (split ':', $b)[-1] > } @array; The block is evaluated for

Re: sorting thoughts

2003-01-30 Thread Steven_Massey
CTED] To: [EMAIL PROTECTED] am.co.uk>cc: Subject: Re: sorting thoughts

Re: sorting thoughts

2003-01-30 Thread Janek Schleicher
On Wed, 29 Jan 2003 16:50:03 +, Steven Massey wrote: > I have an array, each line contains fields seperated by ":" > I want to sort the array numerically ascending by the last field. > > my thoughts are to split fields into seperate arrays, go through the last > array in a comparing process,

RE: sorting thoughts

2003-01-29 Thread david
Bob Showalter wrote: > > This will be quicker than the other methods, especially as the array size > grows. Try your benchmark with an array of say 10, or 100 elements. > yes, it's faster. i didn't include the code since this algr. is well known. just some number for those who are interested: B

RE: sorting thoughts

2003-01-29 Thread Bob Showalter
david wrote: > Steven Massey wrote: > > > > > I have an array, each line contains fields seperated by ":" > > I want to sort the array numerically ascending by the last field. > > > > my thoughts are to split fields into seperate arrays, go through > > the last array in a comparing process, mov

Re: sorting thoughts

2003-01-29 Thread david
Steven Massey wrote: > > I have an array, each line contains fields seperated by ":" > I want to sort the array numerically ascending by the last field. > > my thoughts are to split fields into seperate arrays, go through the last > array in a comparing process, moving each row index in the orig

Re: sorting thoughts

2003-01-29 Thread Rob Dixon
"Steven Massey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] m... > Hi > > just about to embark on a sorting routine, and I thought before I spend > ages(at my ability) I would see what thoughts you guys have on this. > > I have an array, each line contains fields seperated by ":"

Re: sorting thoughts

2003-01-29 Thread Jenda Krynicky
From: [EMAIL PROTECTED] > just about to embark on a sorting routine, and I thought before I > spend ages(at my ability) I would see what thoughts you guys have on > this. As Slobodan Jaksic correctly pointed out a few weeks ago I don't have any thoughts of my own. I just point people to docs :-P

RE: sorting thoughts

2003-01-29 Thread Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote: > Hi > > just about to embark on a sorting routine, and I thought before I > spend ages(at my ability) I would see what thoughts you guys have on > this. > > I have an array, each line contains fields seperated by ":" > I want to sort the array numerically ascending by

RE: sorting thoughts

2003-01-29 Thread Ed Christian
Undoubtedly not the best way of doing this, but here's one stab at it. This assumes you have your data stored in an array as a single string, rather than having an array of array pointers. my @array = ('fred:lucy:24', 'john:jane:10', 'frank:mary:5'); @array = sort { my @a_vals = split (':', $a);