Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Comment on

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

Parts of this post are quotes from Welcome to The Perl Golf Page and are not intended to take credit from the author of said page.)

I would like to propose a new section for - Perl Golf. Perl Golf is a competition to find the shortest (fewest keystrokes) Perl code to solve a given problem. This is different from obfuscated perl where you are trying to come up with code that is difficult to understand. Perl Golf is more the demonstration of Laziness. At times, Laziness has been explained as doing more with less. A variation of that is doing the same with less. Perl Golf is the embodyment of this version of Laziness

As an example, a co-worker has this code on his whiteboard:

$x = length +(sort map 1x y===c, keys %h)[-1];

He put this up as a challenge for us to figure out what it did. But he got this from a Perl Golf entry that he had seen. I found it interesting because it reminded me of an alternate syntax for the map statement that I rarely use. There are also a few other techniques that are educational in this little snippet of code.

I think a format similar to that used in the Snippets Section would be good. You enter a title and description of the problem, and a code entry for people to beat. People would reply with hopefully shorter entries. See the links below for more info on how Perl Golf has developed over time.

In reply to Perl Golf - A proposal for a new section of by johannz

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, 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
  • 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.
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (6)
    As of 2015-11-28 19:30 GMT
    Find Nodes?
      Voting Booth?

      What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

      Results (744 votes), past polls