open ONE, '<' ,'one.txt'; open TWO, '<' ,'two.txt'; my $go=2; while ($go) { my $line1 = ; my $line2 = ; chomp $line1,$line2; print "$line1 \t $line2"; $go--, seek ONE,0,0 if eof ONE; $go--, seek TWO,0,0 if eof TWO; } #### 1 1 2 2 3 3 1 4 2 5