preguntando múltiples preguntas al usuario (sí / no y entrada de nombre de archivo)
Quiero hacerle al usuario múltiples preguntas. Tengo dos tipos de preguntas: S / N o entrada de nombre de archivo. No estoy seguro de cómo colocar todo esto en un bonitoif
estructura. Y no estoy seguro si debería usar las declaraciones de 'else' también. ¿Alguien podría ayudarnos con esto? Esto es lo que tengo hasta ahora:
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)?";
}
}