Introduction to Perl Programming - Beginner's Guide to Exercise


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};



Counting how many times a given (sub)string appears in a given text



para.txt



Post a Comment

Thank you for vising

أحدث أقدم