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

RE: [FWP] 100 point words.



> From: lr@hpl.hp.com [mailto:lr@hpl.hp.com]
> Sent: Friday, July 23, 1999 14:58
> To: 'Eli Evans'; Ronald J Kimball; Brent Michalski
> Cc: fwp@technofile.org
> Subject: RE: [FWP] 100 point words.
>
> > From: Eli Evans [mailto:eevans@libronix.com]
> > Sent: Friday, July 23, 1999 12:45
> > To: Ronald J Kimball; Brent Michalski
> > Cc: fwp@technofile.org
> > Subject: RE: [FWP] 100 point words.
> ...
> > or, if you want a solution that only works on systems where
> > (ord("\n") ==
> > 10) && (ord("A") == 65), you can shave 8 characters ...
> >
> >   perl -e'for(<>){$t=0;for(split//){$t+=ord(uc)-64}$t==46&&print}'
>
> Using your base, 10 characters fewer:
>
>     perl -ne'$t=0;$t+=ord(uc)-64 for split//;$t-46||print'

One fewer than that (two ways):

      perl -ne'$t=0;$t-=64-ord uc for split//;$t-46||print'
      perl -aF// -ne'$t=0;$t-=64-ord uc for@F;$t-46||print'

--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com



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