##
opendir(DIR,$directory);
####
my $a = @oldfiles;
my $b = @newfiles;
if ( $a ne $b ) {
print "the numbers are not equal\n" and die;
}
####
for (my $i = 0; $i < $a; $i++) {
rename $oldfiles[$i],$newfiles[$i];
}