I'm not a much of a coder, but a co-worker in my lab suggested that Perl would be a useful way to automate some data reformating that needs to be done and that it was fairly straight-forward even for a beginner. Basically my data is in a very human readable format right now in text files on my computer. I would like to turn this information into a table format so I can feed it into another program I am using. The data is formated roughly as follows:
#Case Number: 12345
People at table = 5
Seat 1: Joe
Seat 2: Steve
Seat 3: Mary
Seat 4: Jill
Seat 5: Bob
Jill speaks first
Round 1:
Jill says good
Bob doesn't talk
Joe says bad
Steve says good
Mary doesn't talk
Jill says that's enough
Steve says that's enough

Round 2: Next question
Jill says bad
Bob doesn't talk
Joe says bad
Steve says bad
Mary doesn't talk
Bob says that's enough
Then a new case begins in the file.
What I would like to do is go through one case and create a row in a table for each person involved in the case. I need to keep track of the actions taken after each question (a person can give a maximum of 5 responses per round), and what the second question was. I would also like the information about which seat they were sitting in. All of the information is there, I just need help figuring out how to pick through one case at a time (there can be around 100 cases per text file) and matching up the people with their actions in a table. Is this a reasonable thing to accomplish with Perl? Is there a better tool? Any pointers for getting started? Thanks a bunch for any insight.

Considered by friedo - code tags
Unconsidered by castaway - Keep/Edit/Delete: 8/30/1 - Where ?


In reply to New to Perl 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.