Clearer Explanation (I hope):
Given:
a hash table with %procedure, %specimen, %site
A text file containing medical reports (one report per line) which contain mulitple procedures or specimens
Write a perl program that does the following:
read in one line at a time, find all procedures and associated site and specimen
if found, give it a code (for now just the words)
if nothing found on the line, print the line to a different place to keep track off what lines are not being processed
go to next line
there may be more than one procedure or specimen per line
there is a problem in interpeting some data because these words can appear in different order, usage, context (this is an aside)
a simple way to look for multiple entries at this time is matching for 1) or a) or a: or 1: , can be any number or letter really

weekly reports are generated, and i took an educated guess about the types of words found and how they occur in these reports
i want to put these three simple concepts together to create codes, these codes are commonly occurring groups of words which represent some concept
if this program works correctly, it should identify the type of sample, and disregard "junk"
if someone comes in asks do you have thus and such, i want to say thus and such (pun intended)

sorry about the long winded explanation, i am having trouble even writing a basic program which works
additional complexity will come in trying to match for terms and looking for effective strategies to identify in what order things could appear
at present, i would just be happy with something that spits out at least the first occurence of the sample with the basic info

thanks again for your assistance, your code seemed a little easier to follow than what i copied from someone else and did not fully understand

In reply to thanks for the help by g man
in thread filehandles and such by g man

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.