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

Re: [FWP] Recursion, anyone?



On Wed, Apr 11, 2001 at 03:08:58PM -0400, Kort, Eric wrote:
> Anyone care to improve on my first attempt?  If someone reduces this to a
> one-liner, I promise never to post again!  

I only managed a two-liners. Drat. ;)

#!/usr/bin/perl
@e=(A..Z,a..z,0..9,'-');@i=(0)x shift;$\="\n";while($f=1){print@e[@i];
map{$f&&((++$i[$_]>@e?$i[$_]:$f)=0)}0..@i-1;$f&&exit;}


Joy,
`/anick


-- 
"Try everything once except incest and folk dancing." 
                                        - Sir Thomas Beecham

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