Sorry about all the confusion

I had updated the original link but as I didn't get any response, I thought no one will ever look at it. Hence, I created a new post with reference to the original. ...a bit of Panic...

As suggested, I have created an id for my own.

Thanks for your comments and code.. It works nicely..

Update: Using 'Tie', I was able to get the output in the order it was fed into the data structure..

use Tie::Autotie 'Tie::IxHash'; tie my %linked_dsc, 'Tie::IxHash';

some progress...

I want to try few other things by shuffling the blocks in the data file,etc..like shown below and modify the code as required.

Update 2:Atlast, I managed to achieve (script might be clumpsy though compared to your standards) what I wanted- modified the code to read and build the tree irrespective of the order in which the block appears (except for the first one) and also print the hash in the order it was read inside..

You guys are great!!! for the help, guidance and what not.. whatelse I can say!!! special thanks to graff (as I stole his code to create the structure and used that as a subroutine)

Main Name = Countries End Sub Action = Find: NA Text = North America End Sub Action = Find: EU Text = Europe End --- Main Name = EU End Sub Action = Text = France End Sub Action = Text = Italy End --- Main Name = US End Sub Action = Text = Boston End Sub Action = Text = Atlanta End --- Main Name = NA End Sub Action = Find: US Text = United States End Sub Action = Find: CA Text = Canada End Sub Action = Find: MX Text = Mexico End ---

Again.. thanks for your time and guidance


In reply to Re^2: Building hash tree from data file -contd by stumbler
in thread Building hash tree from data file -contd by Anonymous Monk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.