unless (open(INPUT, "$inputfile")) { print "ERROR: Can't open file for reading : $!\n"; } #### open INPUT, '<', $inputfile or die "ERROR: Can't open file for reading : $!\n"; #### while() { #### my @data = split("\t", $_); #### my @data = split /\t/; #### my @data = split; #### my $did1 = $data[0]; my $did2 = $data[1]; my $score1 = $data[2]; my $score2 = $data[3]; #### my %rec; @rec{qw(did1 did2 score1 score2)} = @data; #### my %rec; @rec{qw(did1 did2 score1 score2)} = split; #### # before the loop my $sth1 = $dbh->prepare("select d_id, c_id from d where d_id = ?"); my $sth2 = $dbh->prepare("select d_id, c_id from d where d_id = ?"); # Then within the loop $sth1->execute($rec{did1}); $sth2->execute($rec{did2});