From: Bulat Ziganshin Date: 2003-03-18T14:18:20+09:00 Subject: Re: Accessing hash values sorted by their keys Hello Josef, Tuesday, March 18, 2003, 2:49:45 AM, you wrote: JJS> Is an elegant way of doing this? JJS> h.keys.sort.each { |key| JJS> puts h[key] JJS> } puts h[h.keys.sort] JJS> works but seems unneccarily complicated. JJS> Is there some analogy to the following Fortran 90 snipplet? JJS> DIMENSION a (30, 40), i (5) JJS> PARAMETER (i = (/5, 10, 15, 20, 25 /) ) JJS> x1 = a(1, :) JJS> x2 = a(10, 2:40:2) JJS> x3 = a(1:10, 2:40:2) JJS> x4 = f(2, i) JJS> ! x1 through x4 are arrays JJS> ! x1 is 1st row of a JJS> ! x2 is every 2nd element of the 10th row starting with 2nd element JJS> ! x3 is every 2nd element of rows 1 through 10 " " " " JJS> ! x4 is elements 5, 10, 15, 20, 25 of 2nd row JJS> 'h.sort[*][1].each' would be great... you also can use Range for subscripring array. For a real work with multidimensional arrays it is better to use specific extension, NumericalArray? (i don't remember) -- Best regards, Bulat mailto:bulatz@integ.ru