use strict; use warnings; my $dir = "C:/move/output/test/"; opendir DIR, $dir or die "Unable to open $dir: $!"; while (my $filename=readdir DIR) { my $file = "$dir/$filename"; next unless -f $file; open my $fh, '<', $file or die "Unable to open $file: $!";