Monday, July 30, 2012

My First Perl Program

Started learning Perl scripting language.

This is my own first perl script.

#!:C:\Perl\bin

print "What is the sum of 10+20?\n";
$your_ans=;
chop($your_ans);
$org_val=30;
until($your_ans == $org_val)
{
print "Wrong, Keep try!\n";
$your_ans=;
chop($your_ans);
}
print "Yes, you got it.";

Output:

C:\siva>perl test.pl

What is the sum of 10+20?
50
Wrong, Keep try!
60
Wrong, Keep try!
30
Yes, you got it.

I'll try to give more info on perl scripting in future :)

No comments:

Post a Comment