[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] 100 point words.




On Fri, Jul 23, 1999 at 02:15:48PM -0500, Edward M. Perry wrote:
> > For shortest, can anyone beat this one-liner?
> > 
> > perl -e'while(<>){$t+=1+ord($1)-ord"a"while/(.)/g;print if$t==100;$t=0}'
> > 
> 
> How bout
> 
> perl -e'while(<>){$t+=1+ord($1)-97 while/(.)/g;print if$t==100;$t=0}'
> 

I won't claim shortest, but this one is far faster.

perl -ne '$w=$_; tr/A-Za-z\0-\377/\01-\032\01-\032/d; print $w if (unpack("%16C*",$_) == 100);'

This handles mixed case input and ignores embedded spaces and
punctuation.

--
Eric Krohn

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe