# do the magic and split into functions @functions = split /(?=\bfunction\s)/, $data; #### @functions = split /(?=\n\s*function\s)/, $data;