opendir DIR,"C:/" or die "Cannot read from dir C:/ $!"; for (readdir(DIR)) { # do something... } closedir DIR;