podpowiadanie użytkownikowi wielu pytań (tak / nie i wprowadzanie nazwy pliku)

Chcę zadać użytkownikowi wiele pytań. Mam dwa rodzaje pytań: Y / N lub wpisywanie nazwy pliku. Nie jestem pewien, jak to wszystko ułożyćif Struktura. I nie jestem pewien, czy powinienem też użyć wypowiedzi „innych”. Czy ktoś może nam w tym pomóc? Oto, co mam do tej pory:

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)?";
            }
    }

questionAnswers(3)

yourAnswerToTheQuestion