parse_dir('.'); sub parse_dir { my $path = shift; opendir(HERE, $path) or die "$!\n"; while(readdir(HERE)) { next if /^\.(\.)[0,1]$/; parse_dir($_) if -d $_; #parse files here }