in reply to output unique lines only
$uniquefiles{$fn} = 1;
If your loop comes across the same filename again, it will simply set the same value for the same filename, in effect eliminating the dupes. When you're all done %uniquefiles will only contain the unique filenames, which you can print like so:
If you're just learning Perl, make sure you learn about hashes. They're a very powerful feature.foreach my $k (keys %uniquefiles) { print OUT "$k\n"; }
Steve
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: output unique lines only
by sbp (Initiate) on Dec 07, 2005 at 03:21 UTC | |
by kulls (Hermit) on Dec 07, 2005 at 04:11 UTC |