use strict; use warnings; open (T1, "t1") or die; my @file1 = ; my @file2 = ; my @file; while (@file1 and @file2) { push @file, (shift @file1, shift @file2); } push @file, @file1 or @file2; #catch any leftover while (my $line = shift @file) { #do 'things' with it print $line; } __END__ file1 file1 file1 file1 #### Useless use of private array in void context at junk line 13. file2 file1 file2 file1 file2 file1 file2 file1 file2 file3, kidding... file2 #### use strict; use warnings; $/ = "****"; my @array; while () { chomp; push @array, $_; $/= "####"; } print "@array"; __END__ stuff****more stuff####less #### $ perl junk stuff more stuff less