Please be kind. For I am a stranger to the World of JAPHs. Here is my first JAPH.
#! /usr/bin/perl $a = "a";;foreach $n (1 .. 26){$hash{$n} = $a;;$a++; }$code = '01010.10101.10011.10100..00001.01110.01111 .10100.01000.00101.10010..10000.00101.10010.01100. .01000.00001.00011.01011.00101.10010';;@array= split ( /\.\n*/, $code );;foreach $n ( 0 .. $#array ) { if ($array[$n] ne ""){@letter=split( /\s*/,$array[$n]); $num=convert();$japh.=$hash{$num};}else{$japh.=" ";} }$japh =~ s/\b([a-z])/\U\1/g;; print $japh,"\n";;sub convert{$tot = 0;;if ( $letter[0] ){ $tot += 16;}if( $letter[1]){$tot+=8; } if ($letter[2]){$tot += 4;}if ( $letter[3] ){ $tot+=2;} if ( $letter[4]){$tot+=1;} return $tot;}
Teach me, oh great Obfuscators, for I am ready to learn. - kel -

Replies are listed 'Best First'.
Re: My First JAPH
by c-era (Curate) on Jan 25, 2001 at 02:49 UTC
    This is a good first try. Here are a few hints to help you out.
    1 - Use $_, @_, and %_ as much as possible, also don't use long or descriptive variable names.
    2 - Try to use math expressions instead of plain numbers.
    3 - Use trinary instead of if if possible.
    4 - Try using some evals, this lets you hide your code.

    Below is an example of how you could have worked this to make it more obfuscated.

    # You may want to change the name of $a $a = "a"; # Don't use a simple number, make a math statement instead # Remember that $a++ will increment after the expression is # evaluated. I used %_ as the hash to add some confusion for (1 .. (6/3*10+15/2.5)){$_{$_} = $a++;} # You may want to write a piece of code that generates # this string to hide things a bit more $c = '01010.10101.10011.10100..00001.01110.01111 .10100.01000.00101.10010..10000.00101.10010.01100. .01000.00001.00011.01011.00101.10010'; # Using @_ to add some more confusion @_= split( /\.\n*/, $c ); # Reuse $a and put your sub in it. Note the use of >> # instead of multiple if statements $a = sub {$c = 0; for (0..$#_){$c+=(16>>$_) if $_[$_];}$c;}; foreach ( 0 .. $#_ ) { # Replace your if statement with trinary, dereferance $a to call your +sub $japh.=($_[$_] ne "")?$_{&$a(split(/\s*/,$_[$_]))}:" "; } $japh =~ s/\b([a-z])/\U\1/g; print $japh,"\n"; # Here is it squished together. $a="a";for(1..(6/3*10+15/2.5)){$_{$_}=$a++;} $c='01010.10101.10011.10100..00001.01110.01111 .10100.01000.00101.10010..10000.00101.10010.01100. .01000.00001.00011.01011.00101.10010'; @_=split(/\.\n*/,$c);$a=sub{$c = 0; for(0..$#_){$c+=(16>>$_)if$_[$_];}$c;}; foreach(0..$#_){$japh.=($_[$_]ne"")? $_{&$a(split(/\s*/,$_[$_]))}:" ";} $japh =~ s/\b([a-z])/\U\1/g; print $japh,"\n";
    I hope this helps you.
      Definitely!! Thanks. I have to look up trinary operators but I think I understand the basic gist of them. - kel -