http://www.perlmonks.org?node_id=11136718


in reply to Getting duplicate file contents in perl

Your output file is already in the directory when you glob so your output file is treated as an input. Move the glob before the open.
my @allFiles = glob("$severityDir/*.txt"); open( my $fh, '>>', $severityFile ) or die "Could not open file '$severityFile' $!";
Bill