Aufforderung zur Eingabe mehrerer Fragen an den Benutzer (Ja / Nein & Eingabe des Dateinamens)
Ich möchte dem Benutzer mehrere Fragen stellen. Ich habe zwei Arten von Fragen: J / N oder Dateinameneingabe. Ich bin mir nicht sicher, wie ich das alles in ein schönes setzen sollif
Struktur. Und ich bin mir nicht sicher, ob ich auch "else" -Anweisungen verwenden soll. Könnte uns jemand dabei helfen? Das habe ich bisher:
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)?";
}
}