Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

JAPH / Perl Rube Goldberg Machine

by eighty-one (Curate)
on Dec 10, 2008 at 16:51 UTC ( #729452=obfuscated: print w/replies, xml ) Need Help??

This script performs a simple task in a needlessly complex manner.

I derived this from some work I did out of spite to annoy a Python-programming friend after a discussion about brackets :)

#!/usr/bin/perl -w use strict; my $japh=<<JAPH [}{{[} {] [] ][[]}] [}[{{] {{ {] {] [[ }{ [] }] {] {]{}]} [} {{ [} {] [] ][ [] }] [}[{{] {{[}[[ [] {}{] ]{ {] [}[{]][} [[[}{} [} [{ {][}{] ][{}]} [} {{ [}{] [] ][ [] }] [} [{ {] {{ {] [}{]{{{] [} {} ]} [} {{ [} {][]][[] }][}[{ {]{{[} [[ [] {} {]]{ {] [} [{ {[ [] }] [] }} [} [{ [] ]{ [][[[}{] {] [} {] ][{}]} [} {{ [}{][] ][[]}] [}[{{] {{ {] {] [[ }{ [] }] {]{]{} ]}[}{{ [}{][] ][ [] }] [} [{ {] {{ [}[[[] {} {] ]{{][} [[ {{ [][[ [}{][] }{ {] [}{]][ {}]}[} {{ [} {] [] ][ [] }] [} [{ {] {{{][}{] {{{][}{} ]} [}{{ [}{][] ][[]} ][ }[ {{ ]{ {[ }[ [[ ]{ }{ ]] {{ ][ }[ {] {[]{[[ ]{ }[ ]]}[][ [[ }{ ]{][}{]][{}]}[}{{[}{][]][[]}][}[{{]{{{]{][[}{[]}]{]{]{}]} JAPH ;my $l=''; my $o='';foreach($japh){chomp; my $len= length($_);for(my $p=0;$p<$len;$p++){ my $b=substr ($_,$p,1); if($b eq ' '){ next;}$o.= b2bin($b);if( length($o) == 8){$l.=pack('B8',$o);$o ='';}}}eval( $l);sub b2bin {my $b = shift; if($b eq '{'){return '00';} elsif($b eq '['){ return '01';} elsif($b eq ']'){return '10';}elsif($b eq '}'){return '11'; }}

Replies are listed 'Best First'.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://729452]
Approved by holli
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2021-10-20 13:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (81 votes). Check out past polls.

    Notices?