+my $quote;
+my $fortune;
+if (-e $quote_file.'.dat' and open($fortune,'-|','fortune',$quote_file)) {
+ local $/;
+ $quote = <$fortune>;
+ close($fortune);
+ $quote =~ s/\n$//;
+}
+else {
+ my $quotes = '';
+ my $quotesfile = new IO::File $quote_file,'r' or die "Unable to open $quote_file $!";
+ local $/;
+ $quotes = <$quotesfile>;
+ undef $quotesfile;
+ my @quotes = split /\n*\%\n*/s, $quotes;
+ undef $quotes;
+ my $quote = $quotes[rand(@quotes)];