while ( ($ko,$vo) = each %$old ) { while ( ($kn,$vn) = each %$new ) { # compare } }