Reputation: 357
my %hash={
dev1=> ["T1","T2","T3","T4"],
dev2=> ["T1","T7","T8","T6"],
},
I want to get suppose all value in hash for key dev1 or dev2 . How do I do it? I want the array to be returned when i pass key as an argument.
Upvotes: 0
Views: 32
Reputation: 118595
$hash{"dev1"}
and $hash{"dev2"}
are array references. To access the array, use the array dereferencing operator @{...}
.
@dev1 = @{$hash{"dev1"}};
@dev2 = @{$hash{"dev2"}};
Upvotes: 2