So this one was tricky since it didn't run out of the box due to a problem with quote escaping in the exec ... So here is the solution, that we, a collective of rebel monks for CLEAN CODE have to offer :
Most of the steps are unclosed in {} , to add some obfu .

  • First of all we have a split on either @ARGV or on a long list of num ber if @ARGV is empty . The result goes into @_ (deprecated implicit split to @_ )

  • After this we shift an element that goes to $^ ( the fact that this variable has a meaning for perl formats is here for confusion ...)

    Then we initialize the hash %$^ with two values.Key 1 is the strange _/ sign and key 0 is the new line operator ! This is very tricky since it looks like an empty string but the fact that the carriage return is between the two quotes is taken into account !

  • Then we test (with the ternary operator ? : ) the value of $^ if it is 1 or 0 we print the corresponding value from that %$^ hash . If it is some other value we will print that number of spaces (use of x for strings).

  • At this point we join the list @_ , which has one less element since we shifted something from it .

    In the next block we do :

    {$^="'$^'"}
    This is done to protect the arguments passed to the exec and didn't work with perl 5.6 on windows and 5.005 solaris . So we did instead :
    {$^="\"$^\""}
    Now comes the call to this same script via exec, passing the shifted @_ as an argument and testing if there is more than one argument .

    At this point you see that this will either print _/ or spaces or new lines and it is the choice of the numbers in the initial list that gives the following result :

    _/ _/_/_/_/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/_/ _/_/_/_/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/
  • Rock on !

    ps : since it failed on our box could you tell us on what kind of OS and perl version did you run it ??


    In reply to Re: Live and Die by de_cristian_izer
    in thread Live and Die by cristian

    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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.