in reply to memorizing files and then removing the unnecessary ones
What you want is the difference between the two arrays. That can be computed like this.
#! perl -slw use strict; my @before_files = map{ chr 65+rand 26 } 1.. 4; my @after_files = ( @before_files, map{ chr 65+rand 26 } 1.. 6 ); my %seen; @seen{ @before_files } = (); my @only_new_files = grep{ not exists $seen{ $_ } } @after_files; print "@before_files\n@after_files\n@only_new_files"; __END__ P:\test>junk2 Y B Y A Y B Y A P E F N L U P E F N L U
|
---|