From: Phrogz Date: 2007-03-20T05:45:08+09:00 Subject: Re: Sorting Dates and Times in an array On Mar 19, 2:22 pm, "Paul" wrote: > I've tried using 'sort_by' but I'm not sure how to apply it to multi- > dimensional arrays. What would be the best way to replace the > contents if the data array is really large? a) Ruby doesn't have multi-dimensional arrays in the core. Unless you're using something like NArray, I suspect you're thinking of arrays of arrays. In this case, your problem is 'just coding' - if you want to sort an array of arrays, you can sort the primary axis and then the subsequent arrays. Or you can choose to transpose the array and sort along some other array. b) Replace the contents? Perhaps you really want map! to convert the contents of the array in-place, and then to sort_by{} to twiddle the bits. Or, use less memory and more CPU by using sort!. (It's generally easy in computer programming to trade memory for calculation speed, in both directions.)