$s = 'RAGGTS'; $s =~ s[R][{A,G}]g; $s =~ s[S][{C,G}]g; print while glob $s; AAGGTC AAGGTG GAGGTC GAGGTG