in reply to file's treatment

As others have said, the problem is that "readdir()" returns file names, and the "-f" test needs the path of the directory being read to be attached to each file name, in order to find each file.

One other point: you could do what you want in a single pass, using "grep":

my $path = "C:/some/path"; opendir( ORIG, $path ) or die "opendir failed on $path: $!"; my @filesInDir = grep { -f "$path/$_" } readdir( ORIG ); closedir ORIG;
How easy is that? If you really want to list all the files and non-files to STDOUT while you're reading the directory (which you'll probably get tired of quickly), here's what I would put in place of that single grep line:
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"; }
Personally, I like the shorter version better.