Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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

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 contemplating the Monastery: (9)
As of 2016-10-22 13:01 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (294 votes). Check out past polls.