On Tue, 29 Jan 2002, Joerg Ziefle wrote: > Ok, the tournament's over and we all can continue our lives. :) Congrats to the >winners and all the other superb and ingenious entries! > > Although my 98 strokes are quite a lot, even for a beginner, I see that I had the >right ideas in many cases (e.g., bit ops in even.pl), so I don't feel too ashamed. >Once you know some tricks of the trade, I guess, you can save *big* (or can't you?). > > But after scouring the perldocs and being baffled about the other > solutions, some questions still remain: > > * Where is the empty searchlist behaviour with the 'c' switch of the y/// > operator documented (using y///c to count characters)? >
The 'c' isn't for 'count' but for 'complement'. There are three elements to this. (1) tr/// (let's call it tr/// now we're not playing golf) returns the number of characters. (2) tr/stuf// (with the replacement list empty) is the same as tr/stuf/stuf/ -- in other words it changes things into themselves, and so _just_ counts the characters. (3) tr/stuf//c changes (or rather counts in this case, as the replacement list is empty) the complement of stuf, i.e. all characters _except_ s,t,u,f. So tr///c counts all characters not in an empty list of characters; i.e. all characters. > * Concerning this answer from Ronald Kimball to my question about the counting the >space in front of the hash-bang command line switches: > > "If you can get the command line switches to work *without* that space > character, then you don't have to pay for it." > > How's that possible? > I think that was a joke. > * How sick do you have to be to come up with those <50 stroke solutions for even.pl? >:) > I'll let the experts answer this one. :-) -- Stephen Turner, Cambridge, UK http://homepage.ntlworld.com/adelie/stephen/ "This is Henman's 8th Wimbledon, and he's only lost 7 matches." BBC, 2/Jul/01