Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Random fortune one-liner

by ash (Monk)
on Mar 30, 2000 at 11:54 UTC ( #6523=snippet: print w/replies, xml ) Need Help??
Description: Takes a random quote from a file and prints it. The fortunes should be separeted by the line: !!\n (well. this is probably the millionth time this script is made, speak of reinventing the wheel:) Have fun (o:
perl -e'while(<>){$a.=$_;}@b=split/!!\n/,$a;print$b[int rand@b];' \
Replies are listed 'Best First'.
RE: Random fortune one-liner
by btrott (Parson) on Mar 30, 2000 at 12:05 UTC
    Umm, I don't believe you want the "-n" in there, as that inserts a loop around your entire script body that makes your particular script not work. See perlrun. Without it the script seems to work just fine.
      ok. thanks! Thats why the script never went out of the loop. (Notice the exit; at the end) It works though.
Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: snippet [id://6523]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2023-12-10 17:07 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (40 votes). Check out past polls.