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
In reply to Re^2: will this random-text script work? how do i integrate a template?
by CountZero
in thread will this random-text script work? how do i integrate a template?
by hawthorne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |