paste A B C #### #!/usr/bin/perl -w use strict; use warnings; open(A,"; my @b = ; my @c = ; while (1) { my $fl=0; my $aa = shift @a || ""; my $bb = shift @b || ""; my $cc = shift @c || ""; chomp $aa; chomp $bb; chomp $cc; print $aa, $bb, $cc, "\n"; next if $#a + $#b + $#c; last; }