Friday, August 05, 2005

My Very first Program ...


Saw this kewl thing ... ok, I'm centuries behind ... but I think it just looks cute. SHIT really happens ... (for those who havent figured out the apprent joke yet)

Hurray! I got my very first program up and running ... nothing big - All it does is multiply, calculate the circumference of a circle and some other stuff. Here's the source code for one of the programs hand-typed by yours truly:

#!perl -w

#Write a program that promopts for and reads a string and a number on
#separate lines of inout and prints out the string the number of times
#inducated by the number on separate lines. Use the x operator. If the

#user enteres fred and 3 .. the output should be three lines.


print "Please enter a number\n";

$number = ;
print
"You have entered '$number'. Now, enter a word\n";

$word = ;

print "You have entered '$word'";

$result = $word x $number;
print "The results from this program are:\n$result";


#Did a mistake ... word should always precede number..
#chomp is used to remove a newline (\n) from the character.
#for example, if chomp were to be removed from "word" (assuming 'ok' is used)

#the result would show okokok instead of a neat list. :)


This is the furthest I've got from ever trying to get into programming. I guess I shalt have to go all the way. I'm hooked.

Went out with Winnie just now... walked from Dhobby Ghaut to Bugis. Quite fun ... hehe.

Posted by Unknown at 8/05/2005 10:09:00 pm