Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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 PerlMonks.org - 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 PerlMonks.org by johannz

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2021-12-05 11:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (31 votes). Check out past polls.

    Notices?