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

Re: Adding to hash of hashes

by 2teez (Priest)
on Aug 24, 2012 at 23:56 UTC ( #989658=note: print w/ replies, xml ) Need Help??

in reply to Adding to hash of hashes

but then I want to add an end => 10 to the same anonymous hash without replacing what's already there

use warnings; use strict; use Data::Dumper; my %hoh; $hoh{element1} = {start => 1, middle => 5}; print Dumper \%hoh; $hoh{element1}{end}=10; # add to hash print Dumper \%hoh;
$VAR1 = { 'element1' => { 'middle' => 5, 'end' => 10, 'start' => 1 } };
For more information, please check the following: perldsc, perlref, perllol, perldata, perlobj

Comment on Re: Adding to hash of hashes
Select or Download Code
Replies are listed 'Best First'.
Re^2: Adding to hash of hashes
by AnomalousMonk (Canon) on Aug 25, 2012 at 04:45 UTC
Re^2: Adding to hash of hashes
by Dlamini (Novice) on Aug 25, 2012 at 02:55 UTC

    Thanks, 2teez, that's exactly what I was looking for - I think I tried something similar but must have got the syntax wrong somewhere

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2015-12-01 16:38 GMT
Find Nodes?
    Voting Booth?

    My keyboard shows this many letters:

    Results (20 votes), past polls