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

Re: [FWP] name-a-band



Rick <rklement@pacbell.net> writes:
> I must need help, 'cause I shortened it to:
> 
> chomp(my @dict = `cat /usr/dict/words`);
> printf $_, map ucfirst $dict[rand @dict], 1..3 while <DATA>;

Nice one.  Combining this idea with a couple of mine gives two solutions
that are 75 characters each (or 69 if you use words.txt instead of
/usr/dict/words):

 chomp(@_=`cat /usr/dict/words`);printf$_,map"\u$_[rand@_]",/%/g while<DATA>
 chomp(@_=`cat /usr/dict/words`);$/=511;printf<DATA>,map"\u$_[rand@_]",1..14

The only problem is that there's no error checking on reading the dictionary.

-- 
Aaron Crane   <aaron.crane@pobox.com>   <URL:http://pobox.com/~aaronc/>

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