in reply to Re^2: backreference replaced as literal or just fails
in thread backreference replaced as literal or just fails

"Replace the first occurrence of $rex[0] with $rex1."

Actually /g means replace all occurrences.