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

Re: [FWP] string increment



Piers Cawley wrote:
> 
> Alistair.McGlinchy@marks-and-spencer.com writes:
> 
> Bugger, that was a mistake. Should be:
> 
> perl -le'map/^a*.z*$/&print,aaaa..zzzz'
> 
> > But I think the 2nd "&" is still necessary. Otherwise you just get
> > aaaa..zzzz
> 
> Have you tried it? It worked when I tested it.

in what sense of the word "worked" does it work?  it most
certainly DOES NOT work.  you seem to have a fundamental
misunderstanding of the difference between & and &&.
& is not any kind of a short-circuit operator, while && is:

$ perl -le '0 && print "howdy!"'
$ perl -le '0 & print "howdy!"' 
howdy!
 
> > Any advance on this though?
> >
> > perl -le'map/^a*.z*$/&&print,aaaa..zzzz
> 
> That doesn't work.

how are you defining "work"?  this produces identical output
of the original solution (with the minor difference that the
original solution didn't print 'aaaa'). 
--
Steve Lane <sml@zfx.com>

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