in reply to regex; how it works
The matched regular-expression, which contains parenthesized groups to “capture” various matching-parts out of the input string, returns those matches as a list. The construct ( $a, undef , $b ) = ... is a list assignment, albeit a faintly-unusual one due to the presence of undef as the second term. The corresponding elements of the returned list are assigned as-shown.
BTW, this is why you can swap two variables so easily: ($a,$b) = ($b,$a); ... presto!