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

Pulling JAPH out of nowhere...

by kejohm (Hermit)
on Jun 04, 2011 at 13:13 UTC ( #908124=obfuscated: print w/replies, xml ) Need Help??

Hi monks,

This is my first JAPH. Inspired by perlpacktut.

print pack('C',unpack('%c*',unpack('W',pack('J')))+unpack('%c*',unpack +('a',pack( 'A')))-unpack('%B*',unpack('U',pack('A')))+unpack('%b*',unpack('a',pac +k('A')))), pack('C',unpack('%Z*',unpack('W',pack('A')))+unpack('%W*',unpack('n',p +ack('V'))) -unpack('%C*',unpack('a',pack('A')))),pack('C',unpack('%a*',unpack('C' +,pack('A') ))+unpack('%U*',unpack('b',pack('C')))-unpack('%C*',unpack('a',pack('A +')))- unpack('%B*',unpack('B',pack('L')))),pack('C',unpack('%U*',unpack('c', +pack('A')) )+unpack('%U*',unpack('b',pack('Z')))-unpack('%Z*',unpack('a',pack('A' +)))-unpack ('%b*',unpack('Z',pack('A')))),pack('C',unpack('%U*',unpack('a',pack(' +A')))), pack('C',unpack('%a*',unpack('H',pack('A')))+unpack('%a*',unpack('J',p +ack('j'))) -unpack('%b*',unpack('a',pack('A')))),pack('C',unpack('%C*',unpack('U' +,pack('A') ))+unpack('%B*',unpack('W',pack('A')))+unpack('%b*',unpack('H',pack('h +')))),pack ('C',unpack('%W*',unpack('c',pack('A')))+unpack('%b*',unpack('W',pack( +'A')))+ unpack('%B*',unpack('H',pack('A')))),pack('C',unpack('%U*',unpack('C', +pack('A')) )+unpack('%C*',unpack('I',pack('J')))-unpack('%c*',unpack('Z',pack('A' +)))-unpack ('%b*',unpack('a',pack('A')))),pack('C',unpack('%C*',unpack('C',pack(' +A')))+ unpack('%b*',unpack('H',pack('A')))),pack('C',unpack('%Z*',unpack('C', +pack('A')) )),pack('C',unpack('%C*',unpack('W',pack('A')))+unpack('%b*',unpack('W +',pack('A' )))+unpack('%b*',unpack('H',pack('A')))+unpack('%b*',unpack('J',pack(' +J')))+ unpack('%b*',unpack('Z',pack('A')))),pack('C',unpack('%C*',unpack('Z', +pack('A')) )),pack('C',unpack('%W*',unpack('b',pack('S')))+unpack('%Z*',unpack('Z +',pack('A' )))),pack('C',unpack('%C*',unpack('U',pack('A')))),pack('C',unpack('%W +*',unpack( 'c',pack('A')))+unpack('%B*',unpack('c',pack('A')))+unpack('%b*',unpac +k('H',pack ('A')))+unpack('%B*',unpack('b',pack('A')))+unpack('%b*',unpack('Z',pa +ck('A')))) ,pack('C',unpack('%c*',unpack('c',pack('A')))+unpack('%b*',unpack('c', +pack('A')) )),pack('C',unpack('%C*',unpack('a',pack('A')))),pack('C',unpack('%U*' +,unpack( 'C',pack('A')))+unpack('%B*',unpack('H',pack('A')))),pack('C',unpack(' +%Z*', unpack('H',pack('A')))+unpack('%Z*',unpack('i',pack('N')))-unpack('%b* +',unpack( 'Z',pack('A')))),pack('C',unpack('%C*',unpack('H',pack('A')))+unpack(' +%c*', unpack('C',pack('v')))+unpack('%b*',unpack('Z',pack('A')))),pack('C',u +npack( '%W*',unpack('c',pack('A')))+unpack('%b*',unpack('c',pack('A')))-unpac +k('%B*', unpack('a',pack('A')))),pack('C',unpack('%A*',unpack('C',pack('A')))), +pack('C', unpack('%c*',unpack('C',pack('A')))+unpack('%U*',unpack('c',pack('N')) +)-unpack( '%A*',unpack('Z',pack('A')))-unpack('%b*',unpack('H',pack('A')))),pack +('C', unpack('%U*',unpack('B',pack('i')))-unpack('%b*',unpack('H',pack('A')) +)-unpack( '%b*',unpack('a',pack('A'))));

Replies are listed 'Best First'.
Re: Pulling JAPH out of nowhere...
by Grimy (Pilgrim) on Jun 04, 2011 at 20:48 UTC

    That's a nice one. I like the fact that it uses pretty much all existing pattern elements. It should definitely be added to perlpacktut, its examples aren't unclear enough.

    Unless you're making a motto to using nothing else than packs and unpacks, you could replace the 25 outermost packs by map pack.

      All pattern elements? Does it use all the crazy and redundant ones as well? My favourites are

      $ perl -we 'print unpack "x*(a*\@0X)*(a*@)*", "hello\n";' o lo llo ello hello ello llo lo o $ perl -we 'print unpack(pack("(a*)*", unpack("(a*@[])*", "x./a")), " +J ust anotherr perl hacker\n");' Just another perl hacker $

      Update: see also Just another unpack hacker.

      I was considering using map(), but I figured I should only use pack() and unpack() (I could also have used chr() in place of pack('C',...)).

      There were certain templates that I ignored for one reason or another. The 'P' and 'p' templates would probably only produce random data, and the 'w' template is only available on newer versions of Perl. Also, the 'q' and 'Q' only work on 64-bit Perl, and the 'X' template didn't really seem to make much sense in this context.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://908124]
Approved by muba
[james28909]: ok i have a new question ;)
[james28909]: i am not sure how to ask google this either
[james28909]: i am getting the current time on my machine with scalar localtime;
[james28909]: i am scraping a website and retrieving a date stamp of an article.
[james28909]: well time/data stamp of the article
[stevieb]: james28909: what's the problem/question?
[james28909]: it is not an absolute date like "27" or "31". sometimes it is like wednesday or friday
[james28909]: and i need to format those special instances into an absolute date instead of "yesterday"

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2017-04-29 02:32 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (531 votes). Check out past polls.