# combinedinput.pl use warnings ; use strict ; use File::Copy ; my $INDIR = "C:/output/input"; my $OUTDIR = "C:/output/input/archive"; my $NEWFLE = "COMBINED.output"; my $COUNT = "0"; my $FILE =""; print "[Task started on " . scalar localtime . "]\n"; chdir($INDIR); open (my $FH, '>', "../$NEWFLE") or die "etc: $!"; @ARGV = glob('*.txt'); foreach $FILE (@ARGV) { while (<>) { print $FH $_; $COUNT++; } move($FILE, $OUTDIR) or die "Could not move $FILE to $OUTDIR: $!\n"; } close ($FH); print "\n"; print " Found $COUNT files with data to process \n"; print " Reading all file data into memory \n"; print " $NEWFLE generated successfully \n"; print "\n"; print "[Task completed in "; print time - $^T . " seconds] \n" ; #END #### [Task started on Fri Feb 10 13:49:17 2012] Found 3012 files with data to process Reading all file data into memory COMBINED.output generated successfully [Task completed in 11 seconds]