Nigel Tamplin <[EMAIL PROTECTED]> wrote on Wed, 14 Jun 2000: > I want to combine these, so that when I compose an email it picks a > tag line from a collection of tag lines and sets that as the > signature. > > Are there any tools/ scripts written that do this? It's a pretty simple thing, attached is the perl script randline.pl that I wrote for my own use. It prints out a random line from the file given as argument. Hope this is of use to you, Mikko -- // Mikko Hänninen, aka. Wizzu // [EMAIL PROTECTED] // http://www.iki.fi/wiz/ // The Corrs list maintainer // net.freak // DALnet IRC operator / // Interests: roleplaying, Linux, the Net, fantasy & scifi, the Corrs / The knack of flying: learning how to throw yourself at the ground and miss.
#!/usr/bin/perl if ($ARGV[0]) { open(FILE, "<$ARGV[0]") || die "Cannot open file $ARGV[0] for reading: $!\n"; $lines = 0; srand( time() + $$ ); #srand( (time() >> 1) + $$ ); #srand( time() ^ ($$ + ($$ << 15)) ); while(<FILE>) {$lines++;} seek(FILE, 0, 0); $linenr = 0; for($randline = int(rand($lines)) + 1; $linenr < $randline; $linenr++) { $line = <FILE>; } close(FILE); print $line; } else { print STDERR "No file.\n"; }