in reply to HoH..oA data structure
The last item is always an array but I have an arbitrary number of keys
I'm not clear how an item (singular) can be an array, so what follows may not be exactly what you want, but it should give you a basis from which you can work.
use Data::Diver qw( DiveRef ); my $data; while (<DATA>) { chomp; my @keys = split /:/; my $val = pop(@keys); my $ref = DiveRef( $data, map \$_, @keys ); push @$ref, $val; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: HoH..oA data structure
by bichonfrise74 (Vicar) on May 10, 2009 at 14:23 UTC | |
|
Re^2: HoH..oA data structure
by ig (Vicar) on May 12, 2009 at 15:27 UTC | |
by ikegami (Patriarch) on May 12, 2009 at 15:35 UTC |