my (@first, @second); { local *FILE1; local *FILE2; open(FILE1, $file1) || die "Can't open $file1: $!"; open(FILE2, $file2) || die "Can't open $file2: $!"; @first = reverse split(//, ); @second = reverse split(//, ); close FILE1; close FILE2; } while (@first) { my $couplet = shift @first . shift @second; print "$couplet "; }