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

Re: [FWP] Recursion, anyone?



On Wed, 11 Apr 2001 at 17:46:46 -0300, Filipe Brandenburger wrote:

> I am now thinking about the rules for generating the names.
> Anyone knows what they are? I know that numbers are allowed
> at the beginning of a domain name, but I don't know if - is.
> I also don't know if two -'s in a row (--) are allowed.

>From RFC 1034:

<domain> ::= <subdomain> | " "
<subdomain> ::= <label> | <subdomain> "." <label>
<label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]
<ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
<let-dig-hyp> ::= <let-dig> | "-"
<let-dig> ::= <letter> | <digit>
<letter> ::= any one of the 52 alphabetic characters A through Z in
    upper case and a through z in lower case
<digit> ::= any one of the ten digits 0 through 9

So, the answer that 'A--' is legal.
And www.f--k.com exists, and for sale...

When solving this, don't forget that domains are case-insensitive,
so that your alphabet consists of 37 symbols only, not 63.

I offer this:

print join ' ',eval'map{$n=$_;map{$n.$_}A..Z,0..9,"-"}'x2 .'A..Z'

Where you replace the 'x4' for n-1. Or use 'shift'.
I've no doubt that the 'print join' can be improved on.

Ian
--
"It's recursion, Jim, but not as we know it"

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