in reply to Add an arrayref to a hashref
Yes, it's possible. But what do you want the final data structure to look like?
$hashref->{personal} = $arrayref; # Results in: { name => "Harsha", designation => "Manager", personal => ["Country", "location", "language"], }
But based on the values in the array, they sound more like keys...
@{$hashref}{@$arrayref} = (); # Results in: { name => "Harsha", designation => "Manager", Country => undef, location => undef, language => undef, }
Plus a few more possibilities depending on your expected output, so please show that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Add an arrayref to a hashref
by Anonymous Monk on Aug 12, 2019 at 20:00 UTC | |
by 1nickt (Canon) on Aug 12, 2019 at 20:28 UTC |