[tpm] Larry was only joking

Shlomi Fish shlomif at iglu.org.il
Sun Oct 11 06:09:02 PDT 2009


On Sunday 11 Oct 2009 04:53:28 Quantum Mechanic wrote:
> While wasting time today, I visited the Wikiquote page for Larry
> Wall<http://en.wikiquote.org/wiki/Larry_Wall>.
> Among the numerous gems was this one:
> 
> Hey, I had to let awk be better at *something*...
> 
> :-)<http://groups.google.com/group/comp.lang.perl/msg/af646f4ae85fcbe4>
> 
> The awk in question looked like this:
> : awk is much better than perl at one-line summations:
> > :       awk '{t += $1} END {print t}'
> 
> Which was followed up by this:
> : With perl you can say
> :
> > :       perl -ane '$t += $F[0]'
> > : but you have no way of tacking on an END clause.
> 
> Now, that was a long time ago, so it may have been true then. But certainly
> not anymore, and not for a long time:
> 
> perl -lane '$t += $F[0] }{ print $t'
> 

Heh nice. Golf put aside, you can still use an explicit END {... } clause in a 
-p or -n program.

BTW, I talked with Larry Wall on IRC and from what he recalled perl's -i flag 
was his innovation. Later on, the GNU people implemented a similar "-i" flag 
in GNU sed. The POSIX sed standard still doesn't have it:

http://www.opengroup.org/onlinepubs/000095399/utilities/sed.html

It's possible that the sed implementations of the BSDs (FreeBSD, NetBSD, 
OpenBSD, etc.) have implemented a similar flag, but it may still be absent 
from the seds of older and or less actively maintained distributions (e.g: 
HP/UX , AIX , Win32's Services For Unix , maybe Solaris , etc.)

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
"The Human Hacking Field Guide" - http://shlom.in/hhfg

Chuck Norris read the entire English Wikipedia in 24 hours. Twice.


More information about the toronto-pm mailing list