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

Re: [FWP] Recursion, anyone?



Kort, Eric wrote:
> To that end, here is my little attempt at recursion ...

Uh, I see no recursion in your solution.
In fact, I see no cursion.  No sub!

This is my idea of fun.
Here's a simple solution using recursion:

  my @el=('-',0..9,'a'..'z'); # domain names are caseless.
  @el = qw( x o ); # for testing
  my $l = 3;
  $, = '';
  $\ = "\n";
  w();

  sub w {
    if ( @_ < $l ) {
      for my $e ( @el ) {
        local @_ = (@_,$e);
        print @_;
        &w;
      }
    }
  }


-- 
John Porter

Any technology distinguishable from magic is insufficiently advanced.


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