in reply to Re: forcing list-context
in thread forcing list-context

foreach(readdir $dh) { if (-f){$filenum++} elsif (-l){$linknum++} elsif (-d){$dirnum++} }

You are not going to get an accurate total because you are counting soft links in both $filenum and $linknum.    That would be better as:

foreach ( readdir $dh ) { lstat; if ( -f _ ) { $filenum++ } elsif ( -l _ ) { $linknum++ } elsif ( -d _ ) { $dirnum++ } }