I would like to be able to operate on a list in Perl which is identified by a string. Code can describe this better...
my @colors = ("red", "white", "blue");
my @flavors = ("vanilla", "mint", "chocolate");
print "What favorites do you want to see ?";
my $fav_list = <>; chomp($fav_list);
foreach my $favorite (???) {
print "$favorite\n";
}
Given that $fav_list is either "colors" or "flavors", what should/could "???" in the code above be in order to print out the correct list?