That's because your substitution matches the ]...[ part and replaces it with nothing! You'll have to replace it with $1, which in your regex, contains the letters in between the closing and opening brackets. s/\]([ACTG]+)\[/$1/
Jeff japhy Pinyan,
P.L., P.M., P.O.D, X.S.:
Perl,
regex,
and perlhacker How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart