the_slycer has asked for the wisdom of the Perl Monks concerning the following question:
Thanks..my @newfiles = ("new_one.txt", "old_one.txt", "old_two.txt", "new_two.txt"); my %oldfiles; $oldfiles{"old_one.txt"}="this is the old one"; $oldfiles{"old_two.txt"}="this is the old two"; $oldfiles{"old_three.txt"}="this one should be deleted"; $oldfiles{"new_two.txt"}="this one has been added already"; my %newfiles; foreach (@newfiles){ $newfiles{$_}++; next if exists $oldfiles{$_}; print "have to add $_\n"; } foreach (keys %oldfiles){ next if exists $newfiles{$_}; print "have to remove $_\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Better way?
by MeowChow (Vicar) on Feb 16, 2001 at 10:46 UTC | |
by dkubb (Deacon) on Feb 16, 2001 at 11:50 UTC | |
|
Re: Better way?
by Yohimbe (Pilgrim) on Feb 16, 2001 at 09:59 UTC |