use strict; use warnings; my $PATH = '.'; explore($PATH); sub explore { my $PATH = shift; opendir(my $DIR, $PATH) or return; while (my $SUB = readdir $DIR) { next if $SUB eq '.' or $SUB eq '..'; $SUB = "$PATH/$SUB"; if (-d $SUB) {} if (-f $SUB) {} } close $DIR; }