Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Adding a new key-value pair to a nested anonymous hash

by BillKSmith (Monsignor)
on Jan 17, 2025 at 21:02 UTC ( [id://11163727]=note: print w/replies, xml ) Need Help??


in reply to Adding a new key-value pair to a nested anonymous hash

If you have a large number of references to this structure, it may be worth the trouble to build an index (%referer) to it.
use strict; use warnings; use Data::Dumper; my @lecshun = ( ['namea', { package => 'gema', index => 'dexia', }], ['nameb', { package => 'gemb', index => 'dexib', }], ); my %referer = ( namea => $lecshun[0][1], nameb => $lecshun[1][1], ); print Dumper \@lecshun; $referer{namea}{new_key} = 'new_value'; print Dumper \@lecshun;
Bill

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2026-04-13 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.