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


in reply to Need a start point for resolving {[()]}

While this is not helping you directly, you might want to learn about Lexing and Parsing. I found this on http://www.perl.com/pub/2012/10/an-overview-of-lexing-and-parsing.html which also might be worth reading.


s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e