In general, questions regarding "magic" variables in Perl can be answered by looking in the Perl predefined variables documentation a la:
perldoc perlvar
However, when you search this documentation for $1, etc., you'll find references in a number of places except the section on these "digit" variables. You have to search for
$<digits>
I would have added this to Brian's answer either by commenting or editing, but I don't have enough rep. If someone adds this I'll remove this answer.