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

RE: [FWP] string increment



Sorry if I am missing something obvious here.....

perl -e '$a="aaaa";print $a++,"\n" while $a le "zzzz";'

Now how to make *that* more Fun With Perl is a whole different topic :)

Victor

On 24-Apr-2000 Arjen Wiersma wrote:
> Hey people,
> 
> This nite someone came into #perl on DALnet and asked about a string
> increment routine. He wanted to do the following:
> aaaa
> aaab
> aaac
> ...
> zzzz
> 
> I came up with the following:
> 
> 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"; } }'
> 
> since it's 5 am and my mind went to bed at about 3 this morning I'm sure
> there are faster ways of doing this.. maybe even get caps into it too..
> 
> Any ideas?
> 
> Arjen Wiersma
> arjen@wiermsa.org
> 
> 
> 
> ==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
> ==== Send email to <fwp-request@technofile.org> with message _body_
> ====   unsubscribe

-- 

Victor Brilon
victor@vail.net
http://www.victorland.com

Thought for the day --
How are you Mr. Peterson?
Yeah...as if you care.
--"Cheers"



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