#!perl -w =head1 USAGE ./combine.pl output_file input_1 input_2 [..., input_x] Where output_file is the file to which all input files (input_1, input_2, ..., input_x) should be combined to. =cut use strict; my $out = shift @ARGV; open( my $out_fh, '>', $out ) or die("Could not open output file '$out': $!\n"); for my $file (@ARGV) { open( my $in_fh, '<', $file ) or die("Error opening '$file': $!\n"); print $out_fh $_ while (<$in_fh>); close($in_fh) or die("Error closing '$file': $!\n"); print $out_fh "\n"; } close($out_fh) or die("Error closing '$out': $!\n");