Top

8ball in perl


Perl Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  6.5 (of 2 scores)
Date Added  Sep 26, 2009
Last Updated  Sep 26, 2009
Tags  8ball  ball  eight  perl 

Description

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" .

Grab the Code

#! /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

  (3)  RSS
Ghost-writer
Comments: 353
 
Perl Snippet:  8ball in perl
Posted on Sep 27, 2009 6:34 am
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.
Lord-Harlot
Comments: 64
 
Perl Snippet:  8ball in perl
Posted on Sep 28, 2009 7:34 pm
Considering msl is a shoot language this site should be dedicated to real languages like perl/python/php/c/c++/c# and shoot but no !@#$ msl
Anish
Comments: 13
 
Perl Snippet:  8ball in perl
Posted on Oct 16, 2009 8:25 am
Ghost-writer,
shame man..blind reason..
I'd say, hawkee should be dedicated not only to msl , but also other languages. People like you , who don't like to see any other language on the site should better just stay in http://www.hawkee.com/index.php?type=mirc . And don't go to other sections to discourage people.

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  

Bottom