[TriLUG] OT: Need a thinkpad power supply
Timothy A. Chagnon
tchagnon at futeki.net
Wed Aug 24 13:15:37 EDT 2005
On Wed, 2005-08-24 at 08:07 -0700, Aaron S. Joyner wrote:
> Now for the dissection of Tim's post, for the curious. I welcome his
> commentary or additional comments on how many revs of that perl one
> liner he went through before he got it counting right. :)
That's a pretty good explanation. It should be noted that this was a
~30min exercise done at midnight, so things were not exactly elegant or
entirely accurate. More C-style "i'm not looking anything up" bumbling
than perl efficiency.
Anyway, my history shows that it went through 31 revisions starting at:
perl -n -e 'if( /^From: .*joyner/ ){ print; }'
One comment/explanation I would add was that with the count line:
if(!/^>/&&/[a-zA-Z]/) { $count++; } # and count all the lines
This was meant to count lines that do not start with a ">" character (as
in reply text), and those with an alphabetic character on them.
Perhaps would have been better to count _words_ with something like:
if(!/^>/){@words=split(/\W/);$count+=$#words;}
# if line doesn't start with ">", split on non-words, count the array
Also there were still problems of counting header lines and where
forwarded messages were not prefixed with ">" or another character.
Oh, and fwiw here's the link to that short message:
http://www.trilug.org/pipermail/trilug/Week-of-Mon-20040830/028765.html
Tim
More information about the TriLUG
mailing list