in reply to Read structure in Perl

You appear to have forgotten to include a sample of the data, the perl code, and an explanation of how its output differs from what you want. I'm sure you *meant* to include those, because obviously, without them, no-one can help you.