Monday, January 11, 2016

Introduction to Perl Programming - Beginner's Guide to Exercise

Posted By: Achchuthan Yogarajah - 1/11/2016 07:11:00 AM

Share

& Comment

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



About Achchuthan Yogarajah

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.

0 comments :

Post a Comment

Copyright © 2016 Believe in Yourself - Achchuthan Yogarajah ACHCHUTHAN.ORG. Designed by Templateism .