You don't say what platform you're on, but many *NIX shells use $FOO to signify variable expansion and that works within double quotes (similar to how it works in Perl; go figure . . . :). Switch to single quotes (i.e. perl -i.xml -pe 's#<...#<given_name>$1...#ig' blah) and see if that doesn't stop your shell from drinking your milkshake expanding non-existent shell variables before Perl ever sees your -e code.
Addendum: Not to </pedant> myself, but depending on the state of your shell at the time it expanded $1 etc you might have gotten rather stranger results; you just "lucked out" and managed to have no positional parameters ("unset" rather than "non-existent"; they're perfectly good shell variables that just happened not to have any content).
The cake is a lie.
The cake is a lie.
The cake is a lie.
In reply to Re: Capturing Groups not Capturing for some reason
by Fletch
in thread Capturing Groups not Capturing for some reason
by Ajax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |