.------[ Christopher M Burger wrote (2003/02/04 at 10:51:56) ]------
 | 
 |  I was wondering if anyone had any ideas on how to parse a datafile with
 |  fixed length records but no carriage returns.  All records are on one line.
 |  There are 3 fields per record the first is 10 spaces, the second is 15 and
 |  the third is 40 then it starts back with 10 again.
 |  
 |  Any help would be appreciated.
 |  
 `-------------------------------------------------

    What you'll want to do is something along the lines of: 

    my $data = <DATAFILE>; 
    my $offset = 0; 
    while( $data ) { 
       my $first_field = substr($data, $offset, 10); 
       $offset += 10; 
       my $second_field = substr($data, $offset, 15); 
       $offset += 15; 
       my $third_field = substr($data, $offset, 40); 
       $offset +=40; 
    }

 ---------------------------------
   Frank Wiles <[EMAIL PROTECTED]>
   http://frank.wiles.org
 ---------------------------------


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to