in reply to Re: Re: Re: Golf Channel
in thread Golf Channel
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.
XML::Simpler does not require XML::Parser or a SAX parser.
It does require File::Slurp.
-- grantm, perldoc XML::Simpler