Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Adding to hash of hashes

by 2teez (Vicar)
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

Replies are listed 'Best First'.
Re^2: Adding to hash of hashes
by AnomalousMonk (Chancellor) 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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2018-05-27 06:20 GMT
Find Nodes?
    Voting Booth?