in reply to out of memory problem

What do you expect NEXT to do?

If you want to be more sure that your hash contains valid data, you should include:

use strict; use warnings;

at the start of your script, and fix all the errors reported.

If you're going to claim that it was just a typo when you created your node, just think how easily the same typo could exist in your real code.