in reply to Re^2: \1, \2, \3, ... inside of a character class
in thread \1, \2, \3, ... inside of a character class

Ok, what you want is \1 working as a group of chars. Well, we can't, but you can use some complexer code:
$var = "abXaaabbbc" ; $var =~ s/(..)X(??{"[$1]+"})/${1}#/ ; print "$var\n" ;
Output:
ab#c

Graciliano M. P.
"Creativity is the expression of the liberty".