when designing a website, I find the hardest thing to be filling in some dummy text that doesn't look like I cut'n'pasted the same line a thousand times... so here's a snippet that gives you a somewhat random paragraph.

# how many words to write. my $length = $ARGV[0] || 20; # dictionary file to use. my $dict = '/usr/share/dict/words'; open DICT, '<', $dict or die "Cannot open dictionary file: $!\n"; chomp(my @list = <DICT>); close DICT; print $list[rand(@list)], ' ' for (1 .. $length);

Replies are listed 'Best First'.
Re: random text
by PodMaster (Abbot) on Dec 30, 2002 at 13:27 UTC
    And here I just kept pasting in Hendrix songs, go figure ;)

    You can get some at http://www.alwaysontherun.net/jimi.htm and http://www.alwaysontherun.net/jimi2.htm

    update:

    Hmm, it wouldn't suck to make this into a package (but what name? ), or maybe write an interface to lyrics.com, or some other kind of lyrics database, hmmmm....


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    ** The Third rule of perl club is a statement of fact: pod is sexy.

      How about Lingua::EN::TrentLott ?

      Matt

Re: random filler text
by Aristotle (Chancellor) on Dec 30, 2002 at 15:36 UTC
      Ditto on the Lorem Ipsum filler.
      Here's a site (lipsum.com) with some more information on the subject, as well as another generator.

      --
      "I don't intend for this to take on a political tone. I'm just here for the drugs." --Nancy Reagan
Re: random text
by hardburn (Abbot) on Dec 30, 2002 at 17:28 UTC

    The Fortune module can do something similar. (Untested code below).

    #!/usr/bin/perl use Fortune; my $fortune = Fortune->new($FORTUNE_FILE); print $fortune->get_random_fortune();

    Update: Oops. Always understand the problem before creating a solution. You're creating a bunch of random words, whereas Fortune grabs a random quote.