This is my 2nd JAPH (see my first). Next time I think I'll shoot for something much smaller.

I thought it'd be interesting to write one that consisted entirely of genetic code. Only one "normal" digit was used. Can anyone tell me where it was used and how I could have prevented it?

This is better viewed on an 80-column editor.

#!/usr/bin/perl -w use strict; # JADNA emerging from the gene pool... $_=q=GCGCAT=;my$AT=m++; my$CG=$AT-$AT+$AT;my$TG=$CG +$AT- $CG;my $CAGC=$AT- $CG+$CG+ $AT- $C +G +$AT- $CG-$CG;my$CAGTC=q;;;my%CTACG= (' +C', $AT+ $CG+$TG-$AT-$CG +$CG-$TG,'A' +,$CG -$AT +$CG-$AT-$TG-$CG+$AT-$CG+$TG+$CG,'T',$AT+ + $TG- $CG+ $TG+ $AT-$CG +$AT- $TG-$CG+ + $AT +$CG, 'G',$CG-$AT-$TG-$CG+$AT+$TG+$TG+$CG- $AT+ + $CG); my $GCA= $CTACG {' +T'}** $CTACG{'G'}+$CG;my$CTG =$GCA*$GCA;my $GGC=$GCA /( +$AT +$AT);open(CGGCTA,$0);while(my $CTGCAC=<CGGCTA>) {if($CTG +CAC =~m#(q()(q))#){$CAGC=$AT+$AT-$CG} if($CAGC){my($CGTC)=($CTGCAC =~m#^\s*([ACGT])#); if($CGTC) {$CAGTC .=$CGTC}} }close (CGGCTA); my @CGC=($G +CA, ($CTG- ($GCA+$GCA+$GGC+$TG)), ($ +CTG+ $GCA+$GCA-$CTACG{'T'}), ( +$CTG +$GCA+$GGC), ($CTG+$GCA+$GGC+ +$CG ),($GCA* $CTACG{'T'})+$CTACG{'G'},($GCA*$CTACG{'T'}* $CTACG{ +'G'}) +$GGC,$GCA+$CTG,$CTG+ $CG+$GCA,$GGC+ $CTG- +$TG ,$CG+$CTG,$CTG+$GGC +$GCA-$AT,$CTG-$GCA-$GCA,$CTG+$GCA-$TG-$CG +, $CTACG{'T'}*$CTACG{'T'}*($TG**$CG)*($GCA- $CTACG{ +'G'} ), $CTG- $CTACG{'T'}, $CTG-$CG, +$CTG +$GCA-$CTACG{'T'}); my +@GC= split /T+/,$CAGTC;foreach my$TTC(@GC){my$ +CGTC= $AT -$CG +$AT-$CG- $AT- $ +CG+ $AT+$CG; my$CTGCAC=$AT-$CG +$CG-$AT+$AT-$CG +; while (my $CTCCGA =substr( $TTC, $CTGCAC,$AT)) {$CGTC+= $CTACG {$CTCCGA} *( ($CG+ $TG+ $CG- $AT+$CG) ** $CTGCAC) ;++ $CTGCAC ;} print chr( $CGC[ $CGTC ] ) ; } my $CTCCGA = qq; A -- -- T T -- -- A C --- -- G T --- --- A G ------- C T ----- A A --- T C - G T T - A C ----- G C ------- G T ------- A G ------- C C ----- G T --- A A - T G T - A T ----- A C ------- G G ------- C T ------- A T ----- A G --- C G - C T C - G C ----- G T ------- A A ------- T A ------- T C ----- G T --- A C - G A C - G T ----- A G ------- C A ------- T C ------- G T ----- A G --- C C - G T T - A A ----- T C ------- G C ------- G T ------- A C ----- G A --- T C - G T G - C A ----- T C ------- G T ------- A C ------- G C ----- G C --- G T - A G C - G T ----- A G ------- C C ------- G C ------- G T ----- A A --- T G - C C T - A T ----- A C ------- G G ------- C C ------- G T ----- A G --- C G - C C T - A C ----- G A ------- T C ------- G T ------- A G ----- C A --- T C - G T A - T T ----- A A ------- T ; ;

Replies are listed 'Best First'.
(tye)Re: J.A.D.N.A.
by tye (Sage) on Dec 27, 2000 at 22:44 UTC

    You could replace $0 with __FILE__ (<DATA> also comes to mind but I didn't digest the code enough to decide whether that would be usable here).

            - tye (but my friends call me "Tye")
Re: J.A.D.N.A.
by chipmunk (Parson) on Dec 28, 2000 at 00:43 UTC
    Sadly, strict 'refs' prevents you from replacing $0 with ${$G+$G} ...
Re: J.A.D.N.A.
by turnstep (Parson) on Dec 27, 2000 at 22:38 UTC

    No real way* around your using the "digit" ($0) unless you wanted to resort to using $PROGRAM_NAME, which is a little bit more unobfuscated. :)

    What is supposed to be emerging from the helix anyway? I resized to 80** and squinted but still cannot determine what it is supposed to be...

    *I can think of some really convuluted ways to maybe accomplish this, but they are horribly tortured and somewhat OS dependent.

    **Actually, using the "d/l code" link is a quick and dirty way to see code without all the table stuff.

Re: J.A.D.N.A.
by mirod (Canon) on Dec 28, 2000 at 01:04 UTC

    I get an error on perl 5.005_03 (solaris):

    Missing $ on loop variable at jadna line 30.

    I got read of it by adding a space between the my and the $TTC on line 30

    split    /T+/,$CAGTC;foreach my $TTC(@GC){my$                  CGTC=

    Apart from this it is brilliant!

Re: J.A.D.N.A.
by joecamel (Hermit) on Dec 28, 2000 at 03:22 UTC
    Thanks all,

    I put the code up here so you can see it formatted a little better. It's basically an amorphous cloud-like structure that the DNA emerges from -- still a jumbled mess, just an intentional one. :)