"Kort, Eric" <Eric.Kort@vai.org> wrote: > In a recent article in The Scientist, a commentator states "There is no > counting of www.--ics.com sites to be found on the web." Well, of course > there IS counting them, using basic sockets, if one can only come up with > all the possible name combinations. > > [...] > > Anyone care to improve on my first attempt? If someone reduces this to a > one-liner, I promise never to post again! > Hey, Eric! Two things about your code: 1. When I say 3 in the command line, it actually prints me (mostly) 4 character length words. What leads me to the second bug: 2. Sometimes, (after going through all the array), it prints shorter words. Correcting these two `bugs' stays as an exercise. Hints: the first one is because 0..$max is a list that has actually $max+1 elements, not $max. The second is also because the last element of a list is one less than its size. Tell us if you can find the mistakes. In another direction, I wrote one that prints all words of 1-3 characters made only by lowercase letters. It goes like: perl -le'$x="a";while(length$x<4){print$x++}' For longer words, change 4 to (whatever the maximum length of words)+1. This code uses a magic behaviour of the ++ operation. See perlop on ++ if you can't understand this. - Branden ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe