Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

A bit of fun with pack/unpack

by FloydATC (Chaplain)
on Jun 28, 2013 at 08:28 UTC ( #1041178=obfuscated: print w/replies, xml ) Need Help??

My first, humble attempt at writing (intentionally) obfuscated code:

use strict; use warnings; @==map{unpack('B24',pack('V',$_))}(12580855,16776063,103792,10764419,8 +561235,856483,1974885); foreach$"($[..23){$:=$[;foreach$\($[..6){$:.=substr($=[$\],$",!$[)}pri +nt(pack('B8',$:))}print$/;
-- FloydATC

Time flies when you don't know what you're doing

Replies are listed 'Best First'.
Re: A bit of fun with pack/unpack
by moritz (Cardinal) on Jun 28, 2013 at 17:17 UTC

    You can shave off a few characters by not using parens, and the blockless form of map:

    use strict; use warnings; @==map unpack('B24',pack'V',$_),12580855,16776063,103792,10764419,8561 +235,856483,1974885; for$"($[..23){$:=$[;for$\($[..6){$:.=substr $=[$\],$",!$[}print pack'B +8',$:}print$/;

      That's so much better, thanks for the tip :-D


      -- FloydATC

      Time flies when you don't know what you're doing

Re: A bit of fun with pack/unpack
by perlaintdead (Scribe) on Aug 24, 2013 at 01:59 UTC

    Not too bad. I would suggest reading documentation on functions and finding the little know/used parts of those functions and also thinks about what weird things you can do with them.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://1041178]
Approved by hdb
help
Chatterbox?
Corion idly wonders about creating a series of HTTP requests. There seems to be no framework to generate a series of HTTP requests, like "try all these requests"
[Corion]: This is vaguely inspired by that list of "nasty" strings, which I'd like to replace among HTTP parameters, just to see whether the application crashes, but also for easy downloading of a list of URLs etc
[Corion]: Maybe I'll just conoct something using Algorithm::Permute to create an (OO) generator for such requests, or a simple function.
[Corion]: For testing I imagine one would want to test a random sampling of such "bad"/"unexpected" requests, while for downloading, one would want to generate them all in order, but not necessarily as a huge list

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2017-01-16 15:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (151 votes). Check out past polls.