in reply to Replicate file

Rather than slurping in the entire file before writing it out, it might be better to read in blocks of 4Kb (or some amount suited to your OS):

$/ = \ 4096; # read in 4Kb blocks foreach my $file (@filenames) { open (INFILE, "$file") || die ("Can't open file $file$!"); while( <INFILE> ) { print OUTFILE1; } }
And if you don't really care about files that don't exist (i.e. just ignore them) you can simplify, simplify, albeit by introducing a trick with @ARGV magic:
{ local @ARGV = @filenames; while( <> ) { print OUTFILE1; } }

<pendantry> ... and the correct term is concatenating (although some argue that it is catenating), rather than replicating. </pendantry>