%hash = ( 1 => 'one', 2 => 'two',3 => 'three');
@array = @hash{'1','2'};
If you have a hashref and want to take the values of some keys into an array you can do the following.
$hashref = {1 => 'one', 2 => 'two', 3 => 'three'};
@array = @{%$hashref}{'1','2'};
No comments:
Post a Comment