#!/usr/local/bin/perl my $outfile = shift; # You have to use shift here for magic to work open (OUT, ">$outfile") || die $!; while (<>){ # This is magic, it opens all the files that are on @ARGV print OUT $_; } close (OUT);