use strict; use warnings; my @compare = ( ['/dir1/contents/','/dir2/contents','^cob$'], ['/dir1/contents/','/dir2/contents','\.ffl$','\.1st$'] ); my ($dir1, $dir2, @r, $regex); for (@compare) { ($dir1, $dir2, @r) = @$_; # Load dir info, create hash, compare hash # If hash doesn't match... $regex = join '|', @r; print "$regex\n"; # Sort and run through files, ignoring ones that regex matches if regex exists. # Print directory and file info for files that don't match between directories }