nice one!

SPOILER:

s iir ejkucsath  alnroetph eri;
unobfu: s//r ejkucsath  alnroetph er/;

Using i as a delimiter, you substitute nothing with the string "r ejkucsath alnroetph er" (BTW, this only works if you put a space between the s (or q, qq, etc) and the delimiter), thus putting the string in $_;

split$+

This splits the string in $_ on the value of $+ (Last Paren Match), which is undef. So we end up with the array @_ containing each letter of the string in $_ as an element.

print$_[$-++]until($-++>$#_);

This prints every other element of @_, starting with 0 (i.e. 0,2,4,6,8..). $- (default 0) is used as an array index, but it is incremented twice: One time in the until-test, and one time in the array-indexing itself. The printing stops when $- is greater then the number of elements in @_ ($#_)

print$_[$---]until($---<1);

Basically the same as the last line, only in the other direction. $- now points to the last element of @_. $- gets decremented twice, so now all odd numbers are printed (.. 7,5,3,1) until $- is smaller then 1.

And that's it.

One small comment on the last command: This works, too, and is shorter:

print$_[$---]while($---);

But in fact I like the symmetry more...

-- #!/usr/bin/perl for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}

In reply to Re: Mini Japh by domm
in thread Mini Japh by kelan

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.