cperl-forward-re is a compiled Lisp function in `cperl-mode.el'.

(cperl-forward-re LIM END IS-2ARG ST-L ERR-L ARGUMENT &optional OSTART OEND)

Find the end of a regular expression or a stringish construct (q[] etc).
The point should be before the starting delimiter.

Goes to LIM if none is found. If IS-2ARG is non-nil, assumes that it
is s/// or tr/// like expression. If END is nil, generates an error
message if needed. If SET-ST is non-nil, will use (or generate) a
cached syntax table in ST-L. If ERR-L is non-nil, will store the
error message in its CAR (unless it already contains some error
message). ARGUMENT should be the name of the construct (used in error
messages). OSTART, OEND may be set in recursive calls when processing
the second argument of 2ARG construct.

Works *before* syntax recognition is done. In IS-2ARG situation may
modify syntax-type text property if the situation is too hard.