in reply to memory consumption skyhigh...

Have you looked at Data::Reuse