in reply to Nested While Loop Problem
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Nested While Loop Problem
by Smith (Initiate) on Feb 06, 2009 at 15:06 UTC | |
by kennethk (Abbot) on Feb 06, 2009 at 15:49 UTC | |
by Smith (Initiate) on Feb 06, 2009 at 16:26 UTC |