opendir(DIR, $some_dir) || die "Could not open $some_dir - $!\n"; for my $fileFound(readdir(DIR)) { my $fullPath = $some_dir . "/" . $fileFound; next if (-d $fullPath); # do stuff with each file in $some_dir }