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