use File::Spec; my $dir = "c:\\Perl"; opendir DIR, $dir or die $!; foreach my $file (readdir(DIR)){ my $path_to_file = File::Spec->catfile( $dir, $file ); printf " I see file '%s' path '%s'\n", $file, $path_to_file; next unless -e $path_to_file; unless(-d $path_to_file){ print $path_to_file; my @stats = lstat ($path_to_file); print "\t\$stat = $stats[7]\n"; } }