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


in reply to read_dir issue

You could/should add the "prefix" option in the read_dir statement so that the path will be prepended to the filename.

@files = read_dir($ARGV[0], prefix => 1);

EDIT:
I'd probably reduce your code a little, like this:

my $path = $ARGV[0] || '.'; my @files = read_dir($path, prefix => 1); for my $file (@files) { say -f $file ? "$file is a file" : "$file is a dir"; }