my $fileDir = someawesomepath; opendir(DIR, "$fileDir") || die $!; while (defined(my $file = readdir(DIR))) { next if $file =~ /^\.\.?$/; # Skip the DIR #do stuff with $file } closedir(DIR);