in reply to
Re^2: P2P Golf: MoleSter
in thread P2P Golf: MoleSter
You actually cannot use pop instead of shift in the first line unless you rearrange the argument list order. The same goes for most of the subroutines.
Thank you so much for having pointed out so: I would have never imagined myself...
What I wanted to stress is that even for a mediocre golfer like me at a first glance the code, despite some evident conciseness still was largely suboptimal from this point of view for just applying a standard golfing technique like using pop() instead of shift() (and reversing the order of the arguments - pointing out the obvious, just to keep you satisfied) wherever applicable would have saved quite a lot charachters.
But then it's well known that experienced golfers use any sort of more refined tricks. For example I can remember one case in which there were four arguments to take from the cmd line and it was practically mandatory to assign these to variables so they used something along the lines of this (since the golf rules did not require strictures or warnings):
$$_=pop for a..d;
You cannot use open F,pop; because there are 3 args coming in, not 2.
The &x() syntax is actually the golfed version in several places, particularly &$3($2,$4,$');. Now, in others, it can be removed. But, I sincerely doubt it has anything to do with the author's skills as a programmer. Personally, I'm impressed with a P2P client in under 1000 characters.
Well, indeed if we're talking symrefs then you're right. It may also save some chars in other situations. Generally with modern enough perls the &-syntax does not do what one expects, and as a matter of a fact unless there's a really good reason to adopt it (and indeed in golfing and obfuscation games there may be some well beyond "regular" ones), code that abuses it reveals that he/she who wrote it is still programming Perl4. I'm not sure if this is the case with this particular program, but this is the impression I got at a quick glance.