# do the magic and split into functions my @functions = split /(?=\bfunction\s\w+)/, $data; #### function InitializeTree (objBlah) { // Set up the event handling. with (objBlah) { test = function test2() { doSomethingHere(); }; } return (0); }