in reply to Re^2: Substring consisting of all the characters until "character X"?
in thread Substring consisting of all the characters until "character X"?

That has nothing to do with regexes (and that's why you didn't find it in perlre) but everything with context of the assignment.

Perl has 2 main contexts: scalar context, and list context. A function may behave differently depending on the context. (Actually there are 3 contexts: void context is the third, but it's often treated as a special case of scalar context.) For example: and array returns the array items in list context, and the number of items in scalar context. Example:

@array = ('a', 'b', 'c'); $x = @array; # scalar context => 3 @y = @array; # list context => ('a', 'b', 'c') ($v, $w) = @array; # list context so $v => 'a', $w => 'b'

When you put parentheses around the assignees on the left of the assignment, you get list context. The result is flattened to a list (individual items) and the items on the left get assigned the value of the item at their own position in the list. If there are too few items, the rest gets assigned undef; if there are too many, the remainder is ignored.

And that is what's happening here: the regex is called in list context so it returns the captured items (the value for the patterns in parens) and from that list the value of $1 is assigned to $substring.

Official docs: "Context" in perldata — see also wantarray for making your own functions behave differently depending on context; and scalar to force scalar context on a function call.

For regexes, the docs on context are in perlop (because the // is considered a kind of quotes, and quotes are treated as operators.)