Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Fun with one keyword

by benn (Priest)
on Sep 16, 2003 at 12:12 UTC ( #291796=obfuscated: print w/ replies, xml ) Need Help??

After seeing the genius of Fun With Reserved Keywords, I became a little obsessed with the idea of a JAPH that contained *no keywords*...this is as near as I got. It contains just 6 [a-z] chars. Fewer, anyone?
($;=$^)=~y/\104\117-\132/\101\110-\123/;@_=($^=~/(.)/g,$;=~/(.)/g); $_[2]++;$_[7]=$_[12]++;$_[12]++;$_[3]=++$_[19];$_[3]++;$_[1]=$_[9]++;$ +_[9]++; $_[6]=$";die@_[19,4,0,5,6,7,14,8,5,13,2,9,6,1,2,9,10,6,13,7,12,3,2,9];
Cheers, Ben.

Comment on Fun with one keyword
Select or Download Code
Replies are listed 'Best First'.
Re: Fun with one keyword
by Abigail-II (Bishop) on Sep 16, 2003 at 12:35 UTC
    Three [a-z] chars:
    s//"\160\162\151\156\164\040\042\112\165\163\164\040\141\156\157\164\1 +50\145\162\040\120\145\162\154\040\110\141\143\153\145\162\012\042"/e +e

    No [a-z] chars (might not work on non-Unix; might not work in csh):

    `\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164\150\145\ +162\040\120\145\162\154\040\110\141\143\153\145\162\042\040\076\040\0 +57\144\145\166\057\164\164\171`


      1=~"(??{\160\162\151\156\164'\112\165\163\164 \141\156\157\164\150\145\162 \120\145\162\154 \110\141\143\153\145\162\12'})"
Re: Fun with one keyword
by mtve (Chaplain) on Sep 18, 2003 at 08:11 UTC

    ok, no /w chars or $ signs at all.

Re: Fun with one keyword
by liz (Monsignor) on Sep 16, 2003 at 12:39 UTC
    To get rid of the die, maybe you can do something with backticks. replace last line with something like
    $_[6]=$";$"='';`"echo @_[19,4,0,5,6,7,14,8,5,13,2,9,6,1,2,9,10,6,13,7, +12,3,2,9]"`
    (and of course, the "echo" can be obfuscated just as the rest, but I leave that as an excercise to the reader).

    Unfortunately, this complains of the "echo" executable not found. ;-(

    I guess you either need a generally available executable that prints its arguments, or find out how to call shell commands with backticks.


      Unfortunately, this complains of the "echo" executable not found. ;-(

      That's because your have "echo args" and pass that to the shell - the shell sees that as one token. However, if you fix that and pass echo "args" to the shell, not much will get printed, because that output gets eaten by the backticks. You have to try something like:

      `echo "args" > /dev/tty`


Re: Fun with one keyword
by eyepopslikeamosquito (Chancellor) on Sep 21, 2003 at 06:02 UTC

    I don't know if Abigail still remembers, but way back in August 2001, he suggested the following JAPH:

    BEGIN{$^H=2097152}$_="(?\173\160\162\151\156\164'\112\165\163\164\040\ +141\156\157\164\150\145\162\040\120\145\162\154\040H\141\143\153\145\ +162\012'\175)";/$_/;

    Soon after, Ron Kimball posted this little beauty :

    ''=~("(?{".('}_).} "*}_} }./}(}_ }}_, (}_+}_,*"'& ~'/- + *,+ < + :- /:- << :- @'| ' `` @ `` ` @ ` ` ` ')."})");

    provoking me into building a more general way to generate these kind of programs:

    use Acme::EyeDrops qw(sightly); print sightly( { SourceString => "Just another Perl hacker,", Print => 1, Regex => 1 } );


Re: Fun with one keyword
by jynx (Priest) on Sep 16, 2003 at 23:34 UTC
    As with the competition over here, i wondered if it could be done without any \w characters. Well, i cheated and spliced the idea above from Abigail (using *nix comands via backticks) with the standard way of doing it (bit xor'ing characters) and came up with the following:
    $,=('%'^'@').('#'^'@').('('^'@').('/'^'@').$".('*'^'`').('('^']').( '('^'[').('('^'\\').$".('!'^'@').('.'^'@').('/'^'@').('('^'\\').('(' ^'@').('%'^'@').(')'^'[').$".('+'^'{').('%'^'@').(')'^'[').(','^'@') .$".('('^'@').('!'^'@').('#'^'@').('+'^'@').('%'^'@').(')'^'[').', > / +' .('$'^'@').('%'^'@').('('^'^').'/'.('('^'\\').('('^'\\').('"'^'['),`$, +`
    not very interesting, but it gets the job done...


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://291796]
Approved by sschneid
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2015-10-13 23:08 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (316 votes), past polls