Wow, I may have to start helping more people if this is the response I get! Thank you for the laud (is 'laud' use correctly there?) but I must say that ikegami's reply humbles even the great Lawliet. A one-liner that can replace your whole program!
Of course, one could say that I realized your lack of expertise in the matter and suggested a solution that you can grasp and therefore learn; expanding your knowledge of Perl and enabling you to teach others. In that case, you would be completely correct in thanking me and citing me in your program. :)
Also, note that it was I who bravely /msg'd ikegami to inform him of his lack-of-negation in his original node.
And now back to my normal, un-self-centered life. I am not that egotistical in real life, by the way. I really have no reason to be :P
And you didn't even know bears could type.