my $path = "C:/some/path"; opendir( ORIG, $path ) or die "opendir failed on $path: $!"; my @filesInDir = grep { -f "$path/$_" } readdir( ORIG ); closedir ORIG; #### while ( my $file = readdir( ORIG )) { my $verb = "isn't"; if ( -f "$path/$file" ) { push @filesInDir, "$path/$file"; $verb = "is"; } print "$path/$file $verb a file\n"; }