I agree that premature optimization should be avoided. However, I don't see Perl golf as premature optimization. I see it as a useful tool for mastering the Perl language.

I have spent a fair amount of time playing Perl golf, and I have found that in order to golf well, I am forced to learn everything about the Perl language that I possibly can. I know what all the command line switches do, because in the course of golfing I have read all the documentation and have tried them all. Likewise, I know what pretty much all the built-in variables (like $=, $], etc.) represent, and what their initial values are. Again, this is because I had to know these things to do well at golf. Do I use these things often in real code? Not really. But I know what they are and how to use them, because I now have experience.

In fact, not only does golfing force you to learn about Perl command-line switches and variables, but doing well at golf also requires the opposite of premature optimization. In other words, you have to keep your eyes open for different ways of solving a problem. Even after spending much time working with a particular algorithm, you must always be willing to explore other options lest you miss out on a killer way to reduce your score. There are always several good ways of solving a problem, and your job as a golfer is to determine which is "best" (for a particular definition of "best").

I can see how you might view Perl golf as premature optimization, but for me, it is a great way to improve my Perl knowledge and skill. This post is not an argument against nor in favor of a Golf section. I think they're probably fine in the Obfu section. I just wanted to express my feelings about Perl golf itself.

-- Mike

--
XML::Simpler does not require XML::Parser or a SAX parser. It does require File::Slurp.
-- grantm, perldoc XML::Simpler


In reply to Re: Re: Re: Re: Golf Channel by thelenm
in thread Golf Channel by dragonchild

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.