use strict; use warnings; use File::Find; my %old_list=(); my %new_list=(); my $diffs=DirCompare(); print "$_\n" for @$diffs; find ( sub { $old_list { $_ } = 1 }, $ARCHIVE ); find ( sub { $new_list { $_ } = 1 }, $SourceDir ); sub DirCompare{ for my $file ( keys %old_list ) { if ( exists %new_list{$file} ) { next; } else { push @diffs, "Old file not in new: $file"; } } for my $file ( keys %new_list) { if ( exists %old_list{ $file } ) { next; } else { push @diffs, "Old file not in new: $file"; } } return \@diffs; }