sub test_if_letters_are_included{ # Ask for input say 'Which letters would you like to use?:'; # Capture user input my $input = ; # Remove the trailing newline chomp $input; # Change the input to upper case. $input = uc $input; # create a character set for the regex my $regex ="[$input]"; my @temp_list; for (@list_words) { if ($_ =~ /$regex/g) { push @temp_list, $_; } } @list_words = @temp_list; }