0
与perl一起仍然萦绕在耳边,试图学习如何将它与MySQL一起用来完成数据库任务。我希望不会远离开始提供用户菜单的perl脚本,而是要求输入,我已经开始使用数字1,它将用户输入加载到前面指定的表格中,我的问题是,当选择完成后返回到菜单打印语句的有效方法是什么?所以他们可以不断创建账户等?使用perl构建数据库时,回到菜单?
print "User Menu(please select 1-5):\n 1)Create a new account\n 2)List all the times that an account has logged in\n 3)Log in/out of account\n 4)Drop and re-create the necessary database tables\n 5)Quit\n";
$userInput = <>;
if($userInput == 1){
print "Please enter a user name: ";
$user_name = <>;
print "Please enter a password: ";
$password = <>;
$dbh->do("INSERT INTO user_accounts VALUES ('$user_name','$password')");
#Trying to loop back to the menu.....
#}elsif($userInput == 2){
#test:print "I am number 3";
#}elsif($userInput == 3){
#test:print "I am number 3";
#}elsif($userInput == 4){
#$dbh->do('DROP TABLE IF EXISTS user_accounts');
#test print "I am number 4";
}else{
exit;
}