print "What is your name? ";
chomp($name=<STDIN>);
print "Welcome, $name, are you ready to learn Perl now?";
chomp ($response=<STDIN>);
$response=lc($response);
if($response eq "yes" or $response eq "y") {
print "Great! Lets go get started learning Perl by example.\n";
}else{
print "O.K. Try again later. \n";
}
$now = localtime;
print "$name, you ran this script on $now. \n ";
C:\Users\IBM_ADMIN\Desktop\ORACLE\练习\Perl>perl test.pl
What is your name? Michael J
Welcome, Michael J, are you ready to learn Perl now?Yes
Great! Lets go get started learning Perl by example.
Michael J, you ran this script on Tue Jul 9 16:44:31 2013.
C:\Users\IBM_ADMIN\Desktop\ORACLE\练习\Perl>perl test.pl
What is your name? Jason B
Welcome, Jason B, are you ready to learn Perl now?n
O.K. Try again later.
Jason B, you ran this script on Tue Jul 9 16:45:00 2013.
C:\Users\IBM_ADMIN\Desktop\ORACLE\练习\Perl>