I'd definitely do it with File::Find. Since you already
have an array of files to keep, I'd convert this to a hash (paths/names to keep as they keys).
Then use File::Find to loop through the filesystem and check to see if
each file that File::Find locates is in the hash. If it
is not in the hash, delete it.
Here's a simple codeup of my recomendation.... You should test it
THOUROUGHLY before uncommenting the unlink line..
#!/usr/bin/perl -w
use strict;
use File::Find;
my %keep;
# load %keep with the filenames you want to keep...
# $keep{/bin/sh}=1;
# $keep{/sbin/ifconfig}=1;
# etc....
find(\&checkfile,'/');
sub checkfile{
my $fname="$File::Find::dir/$_";
if(!defined $keep{$fname}){
print "deleting $fname\n";
# unlink $fname;
}
}