Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
etc. I want to remove duplicates from this array in the sense that files with the same -##- are identical, even if they are in different directories. So in the example above, I would want to eliminate /data/node30/file-34-2.txt and /data/node34/file-29-2.txt . I can think of ways to do this, but they are probably inefficient. Since the actual array contains ~10^6 filenames, it needs to be efficient. I believe there is an easy way to do this with hashes, but I can't remember it. Thanks!/data/node12/file-29-2.txt /data/node12/file-34-2.txt /data/node12/file-50-2.txt /data/node30/file-34-2.txt /data/node30/file-60-2.txt /data/node30/file-62-2.txt /data/node34/file-29-2.txt
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Removing duplicate filenames in different directories from an array
by wind (Priest) on Jan 30, 2011 at 20:29 UTC | |
by AnomalousMonk (Archbishop) on Jan 30, 2011 at 23:14 UTC | |
|
Re: Removing duplicate filenames in different directories from an array
by chrestomanci (Priest) on Jan 30, 2011 at 21:15 UTC |