--- tree.pl 2015-10-13 11:59:07.665138800 +0200 +++ tree_afr.pl 2015-10-13 11:58:27.145867300 +0200 @@ -5,11 +5,13 @@ use Pod::Usage; my ( + $showall, # show all, including entries starting with . $showfiles, # show also files $showlinks, # show also a symlink's target ); help() unless GetOptions( + a => \$showall, l => \$showlinks, f => \$showfiles, 'h|help' => \&help, @@ -33,6 +35,7 @@ opendir my $dh, $path or die "Couldn't read $path: $!\n"; # Get all directory content - leaving out files unless asked for my(@content) = grep { !/^\.\.?$/ and ( $showfiles or not -f "$path/$_" ) } readdir $dh; + @content = grep { !/^\./ } @content unless $showall; closedir $dh; # How many eitems are in the directory?