Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
.... and some others you can see I went through some testing and retesting of ideas until I got one that worked, so I just want to know if my methods are good for learning perl better. Basically I would just like any comments, tips, or criticisms from all. :)srand; $index = rand(0..10); print "$quotes[$index]"; ---------- srand; @rquotes = rand(@quotes); print "$rquotes[3]";
#!/usr/bin/perl -w use strict; srand; my $quotes_file = '../quotes/quotes.txt'; open (QFILE, "<$quotes_file") || die "Error: could not open $quotes_file:$!\n"; my @quotes = <QFILE>; my $quote = $quotes[rand(@quotes)]; print "Content-Type: text/html\n\n"; print "$quote";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: quote of the day
by wog (Curate) on Jul 07, 2001 at 00:40 UTC | |
|
Re: quote of the day
by sierrathedog04 (Hermit) on Jul 07, 2001 at 05:55 UTC | |
|
Re: quote of the day
by lhoward (Vicar) on Jul 07, 2001 at 00:37 UTC | |
|
Re: quote of the day
by stuffy (Monk) on Jul 07, 2001 at 06:54 UTC |