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

The "binding" issue is that you didn't give us any possible values for $rrow_test, thus making it harder to determine intent. In any case, the issue you are likely encountering is that you expect your strings to get interpolated twice. According to Regexp Quote-Like Operators, variables you pass get interpolated at run time. This means that "$rex[1]" gets interpolated to "$1", the literal value (Update: as GrandFather points out below). Your solution is to doubly interpolate the string, using the ee modifier. Note this is potentially a serious security risk.

Also note your i modifier is useless in your current construct, as you already handle both upper- and lower-case letter.

  • Comment on Re^3: backreference replaced as literal or just fails