in reply to
compare an array of hashes
Functions such as each_array and pairwise from List::MoreUtils will allow you to iterate over two lists at a time and process them. This assumes that your lists are similar and you are just trying to get different items.
If your data is key driven then you can use a hash to find the unique keys and then grep them from the list.
my @wanted;
my %keys;
$keys{$_->{flag}}++ foreach (@array1, @array2);
my @unique = grep {$keys{$_->{flag}} == 1} @array2;
print Dumper(@unique);