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; }
In reply to Re: HoH..oA data structure
by ikegami
in thread HoH..oA data structure
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |