Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks!

How could a make a directory print different if found? Here are more details
All that has to be done is to give a path to be search on $dir, and this code will print a directory tree out of it, but I would like to see if inside of the given path on $dir more directories are found I would like to see them highlighted for further display options.
Here is the code:

#!/perl/bin/perl use warnings; use strict; use File::Slurp::Tree; use CGI qw(:header); use CGI::Carp qw(fatalsToBrowser); use CGI qw/:standard/; # The tree datastructure is a hash of hashes. The keys of # each hash are names of directories or files. Directories # have hash references as their value, files have a scalar # which holds the contents of the file. my $dir = "c:/progra~1/apache~1/apache2/cgi-bin/test"; my %tree; my $tree = slurp_tree($dir); my $depth = 0; print header(); print_keys($tree); sub print_keys { my $href = shift; $depth++; foreach ( keys %$href ) { if(-d $_){ print "<b>Dir exists= $_</b><br>";} print '****' x $depth, "<input type=checkbox> --$_<br>\n"; print_keys( $href->{$_} ) if ref $href->{$_} eq 'HASH'; } $depth--; }

Thanks a lot!