Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Hash of Hash of Hash of ...

by polettix (Vicar)
on Jul 12, 2005 at 00:33 UTC ( #474137=note: print w/replies, xml ) Need Help??

in reply to Hash of Hash of Hash of ...

Apart from the solution pointed to by tlm, note that you have an error in your code:
use strict; use warnings; my %big_hoh; while ( my $data = get_one_record(...) ) { my @key_list = get_arbitrary_length_key_list($data, ...); my $last_key = pop @key_list; my $storage_point = \%big_hoh; foreach my $key (@key_list) { if ( ! exists $storage_point->{$key} ) { $storage_point->{$key} = {}; $storage_point = $storage_point->{$key}; } } # Added to kick next line $storage_point->{$last_key} = $data; # out of the cycle }

perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Don't fool yourself.

Replies are listed 'Best First'.
Re^2: Hash of Hash of Hash of ...
by shemp (Deacon) on Jul 12, 2005 at 00:47 UTC
    Thanks, i wrote this simplified version based on a piece of my actual code. no one wants to see that, when it's done i hope to never have to touch it again. The real usage is encapsulating some really nasty stuff. :)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2023-02-05 23:23 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (33 votes). Check out past polls.