use strict; use warnings; # I'm actually reading this from another source, but am hand coding # the string here for demonstration purposes. my $char_list = "Iago, Othello, and others"; my @words = split /\W/, $char_list; foreach my $word (@words) { if ($word =~ m/[A-Z]\w+/) { my @entering_chars; push @entering_chars, $word; } }