in reply to If condition

If you correctly indent your code, you'll see that the second if (date) is inside then block of the first if (correct). Obviously $data_pair->{'key'} cannot be equal to 'correct' and 'date' at the same time, so there is something wrong in your logic.

If you could tell us what are you trying to achieve, answering will be simpler.

Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."