perl golf techniques

S

Scott

My company is running a perl golf contest and I am looking for some
tricks hints and techniques that I could use to help with my code. Do
you guys know any good websites, or news threads, that I could look at
which discuss the things people do to help to reduce the length of
their code?

Thanks,
Scott
 
J

Jay Tilton

(e-mail address removed) (Scott) wrote:

: My company is running a perl golf contest

Can your company afford to float a period of zero-productivity? :)

I had to give up competitive Perl golf. It was a deadly addiction.

: and I am looking for some
: tricks hints and techniques that I could use to help with my code. Do
: you guys know any good websites, or news threads, that I could look at
: which discuss the things people do to help to reduce the length of
: their code?

Some good starting points:
http://perlgolf.sourceforge.net/
http://perlgolf.org/

There are details of a number of past competitions on those sites,
including piles of code and discussions of players' inspirations and
algorithms.

Coming up with tips to improve your game is difficult. It's an art to
learn more than it is a craft to teach.

Study perlrun. There's powerful juju in those switches.

Some operators and functions have return values that you don't care about
in everyday code, but are beneficial in golfing. Study perlop, perlfunc,
and perlvar, especially the bits you've never used in your life.

Squish your code through the B::Deparse backend once in a while. The
deparser will often rearrange what you've written into dramatically
different syntax, which can give you ideas on tightening things up.

Drink lots of fluids.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,082
Members
48,773
Latest member
Kaybee

Latest Threads

Top