My present solution works, but it seems like I'm taking a lot of unnecessary steps to get there. If anyone would care to explain how to do this with a regex, or some other method less dependent on a loop, I would much appreciate it.use strict; use warnings; # I'm actually reading this from another source, but am hand codin +g # 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; } }
Update: correction. I'm not looking to capture "Enter," but it's also been split off from the string by the time I get here.
In reply to Seeking a better way to do it by starX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |