my (@files) = glob "c:/progs/*"; #list of progs my (@dirs, @binfiles, @textfiles); foreach my $f( @files ) { -d $f ? push @dirs, $f : -f $f && -B $f ? push @binfiles, $f : -f $f && -T $f ? push @textfiles, $f : next; }