Is there some better way that will do the job?
Yes there is, it's called a hash slice. In general:
@values = @hash{@keys};
so for your example
@a2 = @h1{@a1};
In reply to Re: getting array of values from hash
by adrianh
in thread getting array of values from hash
by twinsen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |