in reply to Re: will this random-text script work? how do i integrate a template?
in thread will this random-text script work? how do i integrate a template?
This will load the File::Random module and make all of its subroutines available in your script.
Then you can do something like:
This script will choose at random 1 file out of all the files in your '//path/to/my/SpamQuoteFilesDirectory' and from this file choose at random 1 to 5 lines and store them in the array @lines.my $dir = '//path/to/my/SpamQuoteFilesDirectory'; my $file = random_file(-dir => $dir); my @lines = random_line($fname, int(rand(5)) + 1);
BTW, you did install File::Random first didn't you?
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: will this random-text script work? how do i integrate a template?
by Anonymous Monk on Jan 16, 2007 at 15:57 UTC | |
by hawthorne (Novice) on Jan 16, 2007 at 15:59 UTC | |
by CountZero (Bishop) on Jan 16, 2007 at 22:10 UTC | |
by hawthorne (Novice) on Jan 18, 2007 at 17:29 UTC | |
by CountZero (Bishop) on Jan 19, 2007 at 17:34 UTC |