use Cwd; print "Current dir is: ", cwd, "\n"; local $_; opendir(TEXTFILES, "desktop") || die "Couldn't open the text file directory: $!"; @data=readdir(TEXTFILES); foreach (@data) { print if(-d "./$_"); } closedir(TEXTFILES);