Well the input will stream in line by line and will look something like this:


asdf
asdfg=4eafvasdfadsf
ashfasdf
asdf qer qwer
asd as dsasdi weeiwer dfhjTITLE#How are you#asdfads
asdfa

asdg
rt
wqrqw
re

DATA-A#item1#asdfdasfdasdasDATA-B#item2#
asdfda
dasfa


asdfdas
DATA-C#item3#
aasdfDATA-A#item1a#DATA-B#item2b#

asd
asdf
asdDATA-C#item3c#
asdf asdf3132 adsf TITLE#I am fine#ads fadsfdasfdas

The do come in order but they may not have a title. I need to store each item as it comes and I won't know when I am done until I get to the end of the stream. There will always be a DATA-A DATA-B and a DATA-C which will be associated with the last TITLE. so I can do this:
if( $line =~ /TITLE/) { $line =~ s/TITLE#(.*)#/$1/; chomp($1); } else if ( $line =~ /DATA-A/) { $line =~ s/DATA-A#(.*)#/$1/; chomp($1); }
ect but that doesn't strike me as an elegant way to do this. The output would be like using a print statement. I was looking at using perlform for the output. To do that, I will need to get all the data first, figure out the max length of each item like:
max length of 'how are you', 'i am fine'
max length of 'item1', 'item1a', 'item4'
max length of 'item2', 'item2b', 'item5'
max length of 'item3', 'item3c', 'item6'
then use that to format the output. I can't get a good example on the forum here without using html which might be part of the confusion. No CSV, no sorting...just display it on the screen using a print statement but make it pretty like a table.
I hope that answers the questions.
THANKS for the help on this.

In reply to Re^2: Looking for Perl Elegance! by perlNinny
in thread Looking for Perl Elegance! by perlNinny

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.