use Path::Class::Rule qw(); my $i = Path::Class::Rule->new->dir->iter; while (my $d = $i->()) { say $d if 3 == $d->dir_list; }