in reply to Need Help With Loops

use strict; #use warnings;

That should be:

use strict; use warnings;

while (<COMPFILE>) { $comptn = substr $_, 0,10; search_tn($comptn); } sub search_tn {

That should probably be:

while (<COMPFILE>) { search_tn( substr $_, 0, 10 ); } sub search_tn { my $comptn = shift;

next until $. > 1;

There is no need for a loop there!

next if $. == 1;

if ($record[0] eq "TLR") { } else {

Better as:

next if $record[0] eq "TLR";

if ($error == "") {

You are using a numerical comparison on a string which will not work correctly.

if ($error eq "") {