open I,"data.dat"; for($I=0;$I<1000;++$I) { $l1=; chop $L1; $L2=; chop $L2; #find the data here printf ("%d, %d, %d\n", $N1, $N2, $n3); }