From: Simon Strandgaard Date: 2005-10-17T18:23:28+09:00 Subject: Re: Convenient way to get many hash elements at once. On 10/17/05, Ron M wrote: > If I have a hash table with a bunch of fields; and I want to > extract a subset of them, kinda like "@a_hashtable{'a','c'}" > in perl, is there a nice way of doing so? > I was hoping something like this would work... > > h={'first name'=>'John', 'last name'=>'Doe', 'birthday'=>'1970-01-01', 'height'=>'5 foot'} > > h['first name','last name'] # hoping for ['John','Doe'] as a result. > h.values_at('first name', 'last name') #=> ["John", "Doe"] -- Simon Strandgaard