From: Tim Pease Date: 2007-02-14T02:26:21+09:00 Subject: Re: Extracting sub elements in array On 2/13/07, WKC CCC wrote: > Is there a fast way to return a subsection of an array object as there > is the minor function for a Matrix? > > For example > testArray = [[1,2,3,4,5], > [7,8,9,10,11]] > > How can the elements [[4,5],[10,11]] be extracted? > > Thanks, > testArray.map {|x| x[-2..-1]} I don't know if it is "fast", but it was certainly quick to write ;) Blessings, TwP