我想问用户多个问题。我有两种类型的问题:是/否或文件名输入。我不确定如何将这一切都放入一个不错的if
结构中。而且我不确定我是否也应该使用“其他”语句。有人可以帮助我们吗?这是我到目前为止所拥有的:
print "Do you want to import a list (Y/N)?"; # first question yes/no
my $input = <STDIN>;
chomp $input;
if ($input =~ m/^[Y]$/i){ #match Y or y
print "Give the name of the first list file:\n";
my $list1 = <STDIN>;
chomp $list1;
print "Do you want to import another gene list file (Y/N)?";
if ($input =~ m/^[Y]$/i){
print "Give the name of the second list file:\n" # can I use $input or do I need to define another variable?;
$list2 = <STDIN>;
chomp $list2;
print "Do you want to import another gene list file (Y/N)?";
}
}