If-else Example:

Define a secret word for this program. Read the name from the person. If the person is Achchuthan then greet him.Other wise say a hello to the person and ask for the secret word until he enter it properly.

Array Example:

Now modify the first exercise as follows: Define secret words as an array with three elements.
Let the user to enter his name and check whether the name is Achchuthanor not. If Achchuthan wish him and exit. Else Say a hello to the user and ask for the secret word. The secret word may be either of those three given.If not continue asking until he gave correct.

Hash Example:

Now try the above exercise for the given set of name and their proper secret words.
%words = qw(
fred camel
barney llama
betty alpaca
wilma alpaca );
To access the secret number related to a name, you can use the following code,
$secretword = $words{$name};

Google+ Badge

About Me

I’m an undergraduate for the B.Sc. Special in Computer Science at Department of Computer Science, University of Jaffna, Sri Lanka.

I’m passionate about Web Development and Programming and I go to extreme efforts to meet my passion. I’m a believer of learning the fundamentals first. I try to understand everything little bit more than the average.

My main areas of interests are Programming, Web Development and Teaching.