http://www.perlmonks.org?node_id=593360

utku has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I cannot figure out how to create a HoH (or even HoHoH) from a file in + following format: path start end delay ---------------------------------------------------------- my_path /path/3434/some_txt wodo -445 your_path /path/3434/some_txt wodo_modo 41 my_path2 /path/232/wge45 wodo_modo 240 my_path /t43/annow23x /a/b/c/43 NA ... Each line above corresponds a "record" and belongs to a "path". So a "path" can include several "records". Above, "my_path" includes 2 records, ie. 1st and 4th lines. I just want to store all lines above into a single hash in the form of: $db_hash{$path}{<index_for_corresponding_path>}{START} $db_hash{$path}{<index_for_corresponding_path>}{END} $db_hash{$path}{<index_for_corresponding_path>}{DELAY} For ex, 1st line will be: $db_hash{my_path}{1}{START} = "/path/3434/some_txt" $db_hash{my_path}{1}{END} = "wodo" $db_hash{my_path}{1}{DELAY} = "-445" ... $db_hash{my_path}{2} must be generated from the 4th line and so forth. The number of "paths" are determined during runtime, thus I must also determine indices for each "path" on runtime. The number of members in each "path" can be different. My question is, how to create index for each unique $path key? I shall create a separate array of indices, shan't I?