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

Re: [FWP] string increment



On Mon, 24 Apr 2000, Arjen Wiersma wrote:
>perl -e '@a=qw(a a a a); for($i=$#a;-1 < $i; $i--) {
>for($x=0;$x<25;$x++) {$b = ord($a[$i]); $a[$i] = chr(++$b); print
>@a; print "\n"; } }'

How about this:

  @x = 'b' .. 'z';

  @l = (map("a$_", @l), map("$_$l[-1]", @x)) for 1..4;

  print map "$_\n", @l;

It could very probably be made to fit in 80. Doesn't print 'aaaa'
though...

--
Tushar Samant
~
~
:wq


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