Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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?

In reply to Creating members of hash of hashes parallelly by utku

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-06-23 04:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.