facedag has asked for the wisdom of the Perl Monks concerning the following question:
I have an array filled with identification numbers, and an array filled with filenames that are based on those numbers. I have about 8000 files, and about 200 of them must get deleted, and I was trying to write a Perl script to do this.
I have the ID numbers in @ID, and the filenames in @files. I attempted to write a foreach loop that checks each ID against the files, and prints the file that matches the ID. Here is what I have:
foreach $ID(@ID) { chomp $ID; if ($ID=~ m/@files/) { print @files } }
Not only does this not do what I would like, it doesn't have any output at all. Would someone please point me in the right direction?
Thanks for reading,
-Jonathan
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Quick Question?
by jrsimmon (Hermit) on Jul 21, 2009 at 02:55 UTC | |
|
Re: Quick Question?
by toolic (Bishop) on Jul 21, 2009 at 03:03 UTC | |
|
Re: Quick Question?
by halfcountplus (Hermit) on Jul 21, 2009 at 03:02 UTC | |
|
Re: Check If 2 Arrays Match
by bichonfrise74 (Vicar) on Jul 21, 2009 at 03:50 UTC | |
|
Re: Check If 2 Arrays Match
by johngg (Canon) on Jul 21, 2009 at 11:23 UTC | |
|
Re: Check If 2 Arrays Match
by facedag (Initiate) on Jul 21, 2009 at 04:02 UTC | |
by ELISHEVA (Prior) on Jul 21, 2009 at 08:52 UTC | |
by gulden (Monk) on Jul 21, 2009 at 11:04 UTC |