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

Re: [FWP] Recursion, anyone?



On Wed, Apr 11, 2001 at 05:16:25PM -0400, yanick1@sympatico.ca wrote:
> On Wed, Apr 11, 2001 at 04:49:14PM -0400, Yanick Champoux wrote:
> > #!/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;}
> 
> Hmmm... Way too verbose.
> 
> #!/usr/bin/perl
> @e=(A..Z,a..z,0..9,'-');@i=(0)x shift;$\="\n";while($f=1){print@e[@i];
> $f&&((++$_>@e?$_:$f)=0)for@i;$f&&exit}


    while($f=1){...;$f&&exit}

can be replaced by

    {$f=1;...;$f||redo}


Also:

    $\="\n";print@e[@i];

takes more than

    print@e[@i],"\n";


But using -l beats that.



Abigail

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