My simple advice to you would be: “This is Golf.” As in, “write-only code.” Simply re-write the damn thing into something that you, and any and everyone else who will in due time follow you, can understand and maintain.
(Incidentally, I would say this about any such piece of code, no matter who the author was, and I would also not be speaking personally against the author in saying this. To me, it is simply an engineering question.)
I believe quite strongly in “The Glance Rule.™”
Source-code should be written in such a way that it can be reliably and accurately understood “at a glance,” by anyone who is moderately(!) versed in the language. If the reader has to “puzzle out” the meaning of the code, however briefly, or to post a question on PerlMonks seeking explanation, it should just be rewritten. Such code often turns out to be rigid, costly to maintain, and sometimes actually slower. Dozens of people over an equal number of years might touch that code before it is retired, if ever it is, and they are usually doing so in order to change what it does, not to fix it or further improve upon it. “Code accordingly.”