Hi, please don't use this code. I wrote it ages and ages ago. The above replies were correct in that there are better ways to do this. Upon thinking back to when I wrote some of the code I've posted to perlmonks, I realize that I had a lot more perl knowledge than I had common sense. In this case, I had a solution for the problem ahead of me, but I didn't understand that I was solving the wrong problem. This may be one of the most important things I've learned over the years; I'm sure somebody here (or even myself) could help you come up with a better, and certainly more elegant, solution to the problem you're trying to solve with the above hack(s).
Tilly is my hero.