#!/usr/bin/perl use strict; use warnings; use Text::CSV; my $dir = "C:/Users/ST/DesktopSample"; opendir (my $gdh, $dir) or die "Unable to open main directory"; my @dirs = grep {-d} readdir($gdh); closedir($gdh); foreach my $tumordirs (@dirs) { #opendir (my $tdh, $tumordirs) or die "Unable to open subdir"; print "$tumordirs\n"; }