There are ways of doing that in Perl, but it's worse than picking your nose in public - don't do it.
If there is some aspect of the code I presented that you don't understand ask about it instead of thinking up ways to avoid it. I suspect you are having trouble with Perl's hashes. If you expect to spend any significant time writing Perl understanding Perl's hash (associative array) data type is critical to using the language well. See perldata for information about Perl's data types. There is a lot to take in there. Take it a little at a time. Back up to the start of a section when you hit a bit you don't understand right off. If something really doesn't make sense come back here and ask.
True laziness is hard work