opendir MYDIR, 'H:/' or die $! ; my @allfiles = grep { $_ ne '.' and $_ ne '..' } readdir MYDIR ; my @files = grep { !-d } @allfiles ; my @dirs = grep { -d } @allfiles ; print "Current directory contains " . @files . " files and " . @dirs . " directories.\n" ;