use IO::File; use strict; use warnings; my @filehandles = map { new IO::File $_, 'r' } @ARGV; while (1) { my @a = map { $_->getline } @filehandles; grep { defined $_ } @a or last; no warnings; print join( "\t", @a ), "\n"; }