*** Sorry for the typo in the previous mail

Hello Gurus,

I am learning perl just by book "sams teach your self
perl in 24 Hours".

I was trying to write a program for but due to some
error in the program, it does not work..

What I want is:

1. On excution you have choice to select
2. if you select choice # 5, it should get confirm if
I want to exit. Answer should be only in Y or y.

3. Any choice other than 1,2 and 5 should be invalid
and the control should go back to the choice option
again, So that you can select the right option.

Thanks for your help


=================> Here the program starts
<===========

#!/usr/bin/perl -wT

$CLS=`/bin/clear`;
print $CLS;

$DATE=(scalar(localtime));
print "\t\t\t\t\t\t$DATE\n\n";

$line="*" x 40;

print "\t\t $line \n";
print "\t\t |                                   |\n";
print "\t\t |   1. Choice A                     |\n";
print "\t\t |   2. Choice B             |\n";
print "\t\t |   5. Exit                         |\n";
print "\t\t |                                   |\n";
print "\t\t $line \n\n";

print "\t\t     Select Your Choice Here :";
$ans=<STDIN>; chomp($ans);

if ($ans==1) {
print "Choice # 1 selected..\n";
}

elsif ($ans==2) {
print "Choice # 2 selected..\n";
}

elsif ($ans==5) {
        print "Do you really want to exit...";
                $choice=<STDIN>; chomp($choice);
                   if ($choice eq Y  OR y) {
                last;                                 
 # Exit from the program
                   else { 
                print "Enter Y or y only..";
                }
        }
}

else {
print "Invalid choice.. Please select again";         
 # Display the message and go back to the the sele
ction option
next;
}
======================================================

__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to