in reply to DNA that is a JAPH

I think this oughta do it...

foreach $letter ( split //, shift @ARGV ) { @digits = (); $num = ord $letter; while ( $num ) { unshift @digits, $num % 4; $num = int $num / 4; } unshift @digits, 0 while @digits < 4; $base4 = join '', @digits; $base4 =~ tr/0123/ATCG/; $string .= $base4; } print $string;

Using this, I get 'perl' to be TGAATCTTTGACTCGA. This was fun, thanks!

"We're experiencing some Godzilla-related turbulence..."

Replies are listed 'Best First'.
Re: Re: DNA that is a JAPH
by theorbtwo (Prior) on Jan 15, 2002 at 00:59 UTC

    Cool, the elegant solution. patgas++. BTW, you both forgot the newline. <G>

    Thanks,
    James Mastros,
    Just Another Perl Scribe