Dereferencing the array was exactly what I wanted. Thank you! "James Edward Gray II" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > On Thursday, September 11, 2003, at 06:58 AM, Phillip E. Thomas wrote: > > > my %hash=(); > > my $mykey="key"; > > my $myval1=$myval2="test"; > > > > #store data in a hash of arrays > > $hash{$mykey}=[$myval1, $myval2]; > > > > Later on I want to retrieve the data and I have to do it like: > > > > $myval1=$hash{$mykey}[0]; > > $myval2=$hash{$mykey}[1]; > > > > There are a lot of array values and I am looking for a more elegant > > way to > > retrieve data, something like > > ($myval1, $myval2)=$hash{$mykey}; (doesnt work) > > Maybe something like the following would help you. The first one > simply dereferences the whole array, the second takes a "slice" of the > array, with the given indexes. > > ($myval1, $myval2)= @{ $hash{$mykey} }; > > or > > ($myval1, $myval2)= @{ $hash{$mykey} }[0, 1]; > > Hope that helps. > > James > > > I'm sure I am missing something embarrassingly simple. Any help would > > be > > appreciated. > > > > Phillip > > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > >
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]