in reply to Hash of Array Comparision...

Nothing obviously wrong jumps out at me, though I'm not sure why you switch from $key1 and $key2 to $value1 and $value2. There's probably an easier way to do it without looping through all of the keys multiple times.

Even if you do minimize the looping, there will be a performance penalty for your do() call within the loop. Better to prepare a statement with placeholders outside and execute it repeatedly.

my $dbh = DBI->connect("DBI:mysql:database=DATA;..."); my $sth = $dbh->prepare("INSERT INTO DATA VALUES(?, ?)"); foreach my $key (keys %hash1) { # check other hash $sth->execute($data1, $data2); }