http://www.perlmonks.org?node_id=423305

saintmike has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed Monks,

does anybody know of a module solving the classic compiler class task of translating an arithmetic expression into RPN (reverse polish notation)? Basically, I have something like

"2*(somevar+other) + max(this, that)"
and want it to be transformed into
("2", "somevar", "other", "ADD", "MULT", "this", "that", "MAX", "ADD")
There's a couple of related modules on CPAN, like Parse::RPN or Math::RPN, but neither one does the trick.

Any pointers to code snippets would be great, before I roll my own.