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