tomdbs98 has asked for the wisdom of the Perl Monks concerning the following question:
I appear to have no knack for using hashes. I have a nested hash structure call $ligHash that points to this:
Now I pass each sub hash (i.e. '34k') to a function that dumps it:$VAR1 = { '34k' => { 'R1' => { ... }, 'R2' => { ... } ... }, '34n' => { 'R1' => { ... }, etc... };
I end up getting instead this:foreach my $lig (%{$ligHash}) { DoDump($lig); } sub DoDump { my $ligand = shift; open TEMP, ">>", "ligandDump.txt"; print TEMP Dumper($ligand); close TEMP; }
Does anyone know why this is happening?$VAR1 = '34k'; $VAR1 = { 'R1' => { ... } etc.. } $VAR1 = '34n'; $VAR1 = { 'R1' => { ... } etc.. }
And as a side question, when I dump the entire structure to a .txt file it ends up being ~6.5mb. Is this excessively large to hold in memory or anything like that?
Thanks ahead of time!-Thomas
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem cycling through top level of nested hashes
by almut (Canon) on Jun 10, 2010 at 16:12 UTC | |
|
Re: Problem cycling through top level of nested hashes
by kennethk (Abbot) on Jun 10, 2010 at 16:14 UTC | |
by tomdbs98 (Beadle) on Jun 10, 2010 at 17:21 UTC | |
|
Re: Problem cycling through top level of nested hashes
by skywalker (Beadle) on Jun 10, 2010 at 19:09 UTC |