in reply to Interpolating $1 within a variable

This method may not suit you, since it does not capture the initial string, but it evades the string evaluation technicalities:

$ perl -le '$_=q(ab cdefg);s/(?<=\w)\b/,/;print;'
This inserts a comma at the first word-nonword boundary in the string

After Compline,
Zaxo