VAC430 Perl Script

This script was written to reformat the VAC430 Report .lst file
The file had already been stripped of headers, footers, and page breaks for loading into Oracle but was missing info on certain lines-- julian and prem_id info wqasn't copied down for subsequent animal records as in this example:
R 83VLE3221   83VLE3473   XX M08 A C Ranch--Koltiska   565279     Sheridan          033 WY C   253 14-DEC-92 4V2  4 445    932100002
R 83VLV9586   83VLV9700      M09 A C Ranch--Koltiska   565279     Sheridan          033 WY C   209 21-JAN-94 1V4  4 445    942010001
R 83VLV9875   83VLV9968      M09  
R 83VMS9449   83VMS9451   XX M11 A C Ranch--Koltiska   565279     Sheridan          033 WY C     3 09-MAR-94 1V4  4 445    942010002
R 83VIP0122   83VIP0129   XX M08 A Cross Ranch         562507     Saratoga          007 WY C   232 29-NOV-89 4V9  4 920    902540014
R 83VIP0131   83VIP0134   XX M08  
R 83VIP0136   83VIP0158   XX M08  
R 83VIP0160   83VIP0214   XX M08
I wrote the vac430.pl script to take file entered on command line and copy the info down so sqlload could handle it.
# VAC430.pl by Mike Moxcey
# takes command line file VAC430 output
# (data only--no headers, page breaks etc)
# and copies missing info to short lines
# for loading into Oracle VAC database again
#
# TO RUN: >perl vac430.pl INPUT.FIL > OUTPUT.FIL

while (<>) {
  $l=length($_);        # $_ is current input var

  if ($l == 133) {
    $oldstr=$_;   #set oldstr var to current line
    $str=$oldstr;
  }
  else {
    $newstr=$_;
    chop($newstr);                   # remove CR/LF
    $leftover=substr($oldstr,$l-1);  # get necessary amount of leftover
    $str="$newstr$leftover";
  }
  print "$str";
}

Mike Moxcey August 1997