open FH1, "what.txt" or die $!; open FH2, "what1.txt" or die $!; my($buf1, $buf2, $total); while (read(FH1, $buf1, 1) && read(FH2, $buf2, 1)) { $total .= $buf1 . $buf2; } close FH1; close FH2;