Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Add an arrayref to a hashref

by 1nickt (Abbot)
on Aug 12, 2019 at 20:28 UTC ( #11104353=note: print w/replies, xml ) Need Help??


in reply to Re^2: Add an arrayref to a hashref
in thread Add an arrayref to a hashref

To add to ++haukex's answer, if you want to add an item, dereference the array and push to it :

push(@{ $href->{personal} }, 'birthday' );
If you don't know the items before you build the aref and store in the href:
push(@{ $href->{personal} }, $_) for @some_list;

Hope this helps!


The way forward always starts with a minimal test.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11104353]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2020-09-18 11:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (112 votes). Check out past polls.

    Notices?