You should always start every script with use strict; use warnings;. These are very good ways of avoiding a lot of pointless headaches.
You could achieve your goal in a fairly straight forward way using hashes. Replace the print statements in your while loop with $count{$dir}++;, which will increment a directory-specific counter. You can then finish your script with print join "\n", keys %count;. For some information on hashes, check out perlintro.
In reply to Re: Nested While Loop Problem
by kennethk
in thread Nested While Loop Problem
by Smith
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |