[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}'
> >
> > :)
> >
>
> Well, if you're going to optimize the ord"a", you might as well remove the
> +1 as well.
>
> perl -e'while(<>){$t+=ord($1)-96 while/(.)/g;print if$t==100;$t=0}'
>
> :)
>
>
> Ronald
OK,
perl -e'while(<>){$a=0;map{$a+=ord()-96}split('');print if$a==14;}'
This betters the original by 2 chars but only ties the latest iteration.
Ed Perry
==== Want to unsubscribe from Fun With Perl? Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
==== unsubscribe