in reply to perl regex referencing

The back slash is used inside the match and the dollar sign is used outside of the match. In this case "inside the match" refers to (a-z)\1 because the text is being matched against this regex. The dollar 1 is not being matched against. It's part of the substitution.