http://www.perlmonks.org?node_id=1079099


in reply to Why is my result empty?

Slightly OT, but if you have a lot of such character-for-character translation to do (a bio-app?), consider using  tr/// instead of  s/// (pattern substitution) for faster operation (see  tr/// in Quote-Like Operators in perlop):

c:\@Work\Perl\monks>perl -wMstrict -le "my $s = 'xxxDxUxxDDxxUUxDUDxUDUx'; print qq{'$s'}; ;; $s =~ tr/DU/M/; print qq{'$s'}; " 'xxxDxUxxDDxxUUxDUDxUDUx' 'xxxMxMxxMMxxMMxMMMxMMMx'