I am a newbie to Perl.
I have a list of records (sorted by Invoice #, and decending time) with 4 columns as follows:
invoice, agent, date, timeInMin.
(timeInMin is just hours*60+minutes)
The records look like this:
-------------/cut/--------------------
1056128833340 Robb 2003-06-20 665
**
1056128833340 t028348 2003-06-20 607
1055439973653 T012697 2003-07-22 962
1055439973653 t012697 2003-07-22 948
1055439973653 t806174 2003-07-15 792
1055439973653 T806174 2003-07-15 791
1055439973653 t021191 2003-07-08 786
1055439973653 Robb 2003-06-17 503
1055439973653 Larry 2003-06-16 815
**
1055439973653 t021191 2003-06-12 646
--------------/cut/----------------------
(** indicates the records I want to pull out)
As you can see, there are mulitple records for each invoice.
I'm trying to figure out how would I determine the most RECENT record that has Larry or Robb as the agent, and where the immediately previous record does NOT have Larry or Robb as the agent. I need to do this for every invoice.
MrI
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.