# suppose we have input file names in @file_in # and output file name in $file_out open OUT,">$file_out"; foreach my $current (@file_in) { open IN,$current; print OUT while ; close IN; } close OUT;