in reply to RAM Question
Perl itself runs in ram, and each bit of extra program you write consumes a little bit of RAM.
If you declare something, perl will allocate some space for it. You can reduce the RAM used by your vars by undef'ing them when they're not needed, but if the variable exists, then there will be a little bit of ram used.
Perhaps i'm misunderstanding the question, or perhaps someone else can explain it a better than i.