Thanks to all who responded to previous query. Hopefully I will someday be a better Perl programmer for it.
 
Now on to another perplexing problem....
 
I have a line that looks like this:
 
 TOXFY-1       LENDER:                                                        DISBURSEMENT DATE:              RUN DATE: 05/01/2001
 
I want to pull off the 1st field and the date.
 
This code works but is somewhat kludgey:
 
    165     seek(FILE,0,0);
    166     $reread = <FILE>;
    167     print "$reread\n";  <== for debug
    168     chomp($reread);
    169     $treread = $reread;       # save reading same record twice
    170     $reread =~ /(\s*\w+\W\w+)/;
    171     $REPID = $1;
    172     $REPID =~ s/^\s+//;
    173     $REPID =~ s/\s+$//;
    174     $treread =~ /(\d{2})\D(\d{2})\D(\d{4})/;
    175     $RUNDATE = "$1/$2/$3";
 
This code which is only slightly more elegant doesn't work, but I think it should. Obviously, I am missing an important point.
 
    165     seek(FILE,0,0);
    166     $reread = <FILE>;
    167     print "$reread\n";
    168     chomp($reread);
    169     $reread =~ /(\s*\w+\W\w+)\D+(\d{2})\D(\d{2})\D(\d{4})/;
    170     $REPID = $1;
    171     $REPID =~ s/^\s+//;
    172     $REPID =~ s/\s+$//;
    173     $RUNDATE = "$2/$3/$4";
 
Why doesn't \D+ swallow everything over to the date?
TIA.
 
--
-------------------------------------------------------------------------
"They that can give up essential liberty
   to obtain a little temporary safety
   deserve neither liberty  nor safety."                     
 
-- Benjamin Franklin
-------------------------------------------------------------------------
RRRRR                Gary Luther
RR  RR               SAF
RR  RR UTABEGAS      2500 Broadway
RR RR                Helena, MT 59602
RRRR                 [EMAIL PROTECTED]
RR RR  ULE !!       
RR  RR               Visit our website at
RR   RR              http://www.safmt.org

BEGIN:VCARD
VERSION:2.1
X-GWTYPE:USER
FN:Gary Luther
TEL;WORK:0631
ORG:;Computer Center
TEL;PREF;FAX:(406) 444-0684
EMAIL;WORK;PREF;NGW:[EMAIL PROTECTED]
N:Luther;Gary
TITLE:Systems Administrator
END:VCARD

Reply via email to