in reply to create subroutine

What about creating a 4 hashes with in your original hash or do you need 4 seperate hashes?

You could do something along the lines of:

$myhash = {my_key=> {sub_key=>sub_data} }

where my key is 1-4 depending on which hash it is, and then your data is easily divided in the subhash.

Without some kind of sample data it's sort of hard to get a feel for what you want, but I hope that helps.