Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Pulling JAPH out of nowhere...

by Grimy (Pilgrim)
on Jun 04, 2011 at 20:48 UTC ( #908146=note: print w/ replies, xml ) Need Help??


in reply to Pulling JAPH out of nowhere...

Hi,

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.


Comment on Re: Pulling JAPH out of nowhere...
Re^2: Pulling JAPH out of nowhere...
by kejohm (Hermit) on Jun 05, 2011 at 01:00 UTC

    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.

Re^2: Pulling JAPH out of nowhere...
by ambrus (Abbot) on Jun 08, 2011 at 10:32 UTC

    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://908146]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2014-10-23 08:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (125 votes), past polls