It sounds like ikegami and GrandFather have some good suggestions for you, but as far as I understand it, perl doesn't have a get_defined_vars() like php does. Based on what I read in this thread it sounds like going with one of the other suggestions here is your best option.