[Israel.pm] Populating a has table

Peter Gordon peter at pg-consultants.com
Thu Feb 21 01:09:51 PST 2008

Suppose I have the following raw data
aaa bbb ccc 1
ddd eee 2
aaa fff ddd hhh 3

I want to populate a hash thusly:
$hash->{aaa}{bbb}{ccc} = 1 
$hash->{ddd}{eee} = 2 
$hash->{aaa}{fff}{ddd}{hhh} = 3

What is the best way for populating the hash from the raw data, given
that the data could go to any depth?


More information about the Perl mailing list