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

Re: [FWP] string increment



here it is, just a little bit shorter

perl -le'$i=3;$_=aaaa;do{print}until++substr($_,$i,1)eq z&&!$i--;print'

----- Original Message -----
From: Ronald J Kimball <rjk@linguist.dartmouth.edu>
To: Geoffrey Young <gyoung@laserlink.net>
Cc: 'Neko' <tgy@chocobo.org>; Arjen Wiersma <arjen@wiersma.org>;
<fwp@technofile.org>
Sent: Monday, April 24, 2000 6:42 AM
Subject: 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--;pr
int'
> >
> > 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
>


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