En op 10 maart 2002 sprak [EMAIL PROTECTED]:
> Rick is a brilliant golfer and I feel sure he would have found the
> same "ugly" improvement from s/$&/$&/g to split$& had he not been
> suffering from the giggles.
That was NOT an ugly improvement, IMNSHO. When I thought up the idea of
counting the fenceposts, I had about the same reaction as Rick when he
found the s/$&/$&/ solution.
> 3) Be pragmatic. Don't get too carried away with fanciful solutions.
>
> This is a common failing among chess players; they spend an hour
> or more analysing a fanciful line, only to reject it and find
> themselves in time trouble later in the game.
>
> Perhaps, Eugene and Stephen Turner fell into this trap in the
> secret number game, where they both pursued deliciously complex
> variations involving the (${}) construct in preference to simpler
> more pragmatic solutions involving s///eg.
Actually, I did look for other solutions; I just could not find them.
I did not try the s///eg within s///eg way, as I was sure that couldn't
work. Earlier, I had tried things like m#___(?{___/./___})___#, which
produced an error message about non-reentrant regex-routines.
I know... I should have tried anyway.
> Most of the top Perl golfers have such good technique that if you
> throw them an idea, they can quickly refine it into a solution.
> But how do you find the ideas?
Read manpages. Perlrun, perlvar, perlfunc and perlre especially.
Turn off the computer and go do something else that does not require
much thinking. I get most ideas in the shower, in bed just before I go
to sleep, or while riding a bike to/from work. (If anyone on fwp lives
around Utrecht & drives a car: please be careful during golf games.
Thank you.)
> I welcome any practical advice on
> this, especially from Ton, who seems most prolific in this area.
> For example, how do you dream up things like s//pop/e?
I think I have first seen this technique, setting $_ using s///e, in a
post by Abigail some years ago. So that's another hint: read Abigail's
complete works.
Eugene