If I have a match operator, how do I save the parts of the strings captured in the parentheses in variables instead of using $1, $2, and so on?
$1
$2
You can use named capture buffers:
if (/ (? .+? ) \s* : \s* (? .+ ) /x) { $hash{$+{key}} = $+{value}; }