for each line in between 'NAME' and 'ADJ TO TOTALS:', do this { add this line to the @data array now go through each element of the @data array, and do this { # <-- WHY?! if this line has 1235114182 in it, do this { put this line at the end of $lines if $lines has '0.00' at offset 118, do this { print the @data array } empty the @data array, $lines, etc. } } }