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

Re: [FWP] string increment



On Mon, Apr 24, 2000 at 08:39:58AM -0400, Geoffrey Young wrote:
> 
> > Not faster like Arjen wanted, but down to 84 chars:
> > 
> >     perl -le'print$_="aaaa";$i=-1+length;print
> >         while++substr($_,$i,1)lt"z"or$i--;print'
> > 
> > That's 4 over par.  I bet someone can do better.  Golf anyone? :)
> 
> well, I'm new to the list, so I'm still getting used to the rules, but how
> about:
> 
> perl -le'$_="a"x4;$i=-1+length;do{print}while++substr($_,$i,1)lt"z"or$i--;print'
> 
> that's a bogey :)

Squeezing a little more...

  perl -le'$_=aaaa;$i=y///c;do{print}while++substr($_,$i-1,1)lt z||--$i;print'

Ronald

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