Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Some additional tips...

  • First, think of something interesting to do. Second, think of an unobvious way to accomplish it. Then start writing the code. With an obfuscated algorithm from the get-go, and code that does something interesting, your obfu will be sure to please.
  • Avoid using
    if (condition) { foo; } else { bar; }
    when you can instead use the trinary operator: (condition)?foo:bar;. This is especially important when you have nested conditionals.
  • Try to model parts of your code around paradigms that a lot of people aren't familiar or comfortable with, such as functional or logical programming. Combine these with often-poorly-understood data structures if possible. For instance, having map generate a hashref of closures each iteration is sure to confuse at least some of the people reading your code.
  • Include POD that is simultaneously cryptic and actively misleading.
  • Play strange games with context and precedence.
  • Abuse symbolic references.
  • Include at least one red herring, but make sure that it is just as obfuscated and hard to follow as the rest of the code, so that it will not be immediately written off as a red herring.
  • While writing your code, go ahead and use obfuscatory techniques, but keep some line breaks and comments in so you can keep track of what you're doing; once you get it working just the way you want and nicely obfuscated, then remove the comments, golf it down a little, and alter the whitespace to reform the code into the shape you want; test after every couple of changes to make sure it still does what you want.
  • Don't break up into subroutines at the natural places; leave things inline that in real code would be better broken out as subroutines, and instead break things out as subroutines that would be better off inline in real code. Make sure your subroutines do things with the caller's variables, if possible.
  • Try to use hashes and arrays with the same single-character names as the scalars you are using, especially any punctuation-named special variables you are abusing.
  • When using regular expressions, don't use regular /slashes/ as delimiters; find more interesting characters for that, preferably ones that are also used for other things both within the regexen (where they will have to be escaped) and near them in the code.
  • Abuse the /e modifier with regex substitutions.
  • Nested string eval can be fun; combine it with $_ and substitutions to create self-modifying code.
  • Use things for multiple unrelated purposes. For instance, if you have an array or hash that you happen to know contains some elements, you can grab it in scalar context any time you need a true value. Similarly, any variable that you know contains a non-numeric string can be used as zero in numeric context. Apply this principle as often as possible, in as many different ways as possible.
  • Converting foreach and even while loops into map will often shave off several characters, with the added benefit of allowing you to assign the result to an array (or hash!) which you can subsequently use as a red herring, a true value in boolean context, or even as a number.
  • Golf, but don't overgolf. Frequently the absolute shortest way to say something is not the most confusing.

  • "In adjectives, with the addition of inflectional endings, a changeable long vowel (Qamets or Tsere) in an open, propretonic syllable will reduce to Vocal Shewa. This type of change occurs when the open, pretonic syllable of the masculine singular adjective becomes propretonic with the addition of inflectional endings."  — Pratico & Van Pelt, BBHG, p68

    In reply to Re: Writing highly obfuscated code in Perl by jonadab
    in thread Writing highly obfuscated code in Perl by marko

    Title:
    Use:  <p> text here (a paragraph) </p>
    and:  <code> code here </code>
    to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2014-04-16 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (414 votes), past polls