It seems to me that it might be easier to pre-parse this, then examine your data structure to see what matches. Treating it like a single string might make it easier also:
local($/);
my $data = <PL>;
while ($data =~ /
\s*(?:-\s.\s-)? # eat up "- A -"
\s*(\w+), # eats up spaces, last name in $1
\s(?:(\w+\.)\s)? # MI. in $2 (if any)
(\w+) # first name in $3
\s*(\d+) # phone number in $4
\s+(\S+) # room number in $5
\s{1,6}(\S*) # grabs the next "close" string, ORG in $6
/sxg) {
# store and/or check to see if this is our guy
}
The
while loop in conjunction with the
g regex modifier will keep the test going through the entire string, which is effectively all of your data. I haven't tested that regexp, but it "seems" correct.. Fix it up if you need to.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.