8ball in perl

By Anish on Sep 26, 2009

A simple 8ball script that I coded in perl recently :)
Hope you like it . You can quit the script at anytime by typing "quit" or "exit" .

#! /usr/local/bin/perl
while(1) { 
print "Enter your question\n";
$question = <STDIN>;
if ($question =~ /quit|exit|^\s*$/i) { print "\n Terminating ... \n"; last; } 
print "hmmm...\n";
$n = int(1 + rand 8); ## generating a random integer from 1 to 8 
if ($n == 1) { print "Uh huh, I do think so .\n"; } 
elsif ($n == 2) { print "Network busy , try again later.\n"; }
elsif ($n == 3) { print "Thats impossible!!!\n"; }
elsif ($n == 4) { print "Dunno. Thats a difficult one :x \n"; }
elsif ($n == 5) { print "Yes , definitely .\n"; }
elsif ($n == 6) { print "No ways demmit!\n"; }
elsif ($n == 7) { print "No idea.\n"; }
else { print "Yep , looks like ;D\n"; }  
print "\n";
}

Comments

Sign in to comment.
Lord-Harlot   -  Sep 28, 2009

Considering msl is a shitty language this site should be dedicated to real languages like perl/python/php/c/c++/c# and shit but no fucking msl

 Respond  
Ghost-writer   -  Sep 27, 2009

Woahhh - Cant even believe i made a post like this :|, sorry :), good use of perl. Make a script 100 people have already made in msl.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.