in reply to Seeking a better way to do it
Use grep!!!
Update:my $char_list = "Enter Iago, Othello, and others"; my @Word_List = grep { /[A-Z]\w+/ } split(/\W/, $char_list); print "@Word_List\n";
Simple way with regular expression,
my $char_list = "Enter Iago, Othello, and others"; my @Word_List; @Word_List = ($char_list =~ /([A-Z]\w+)/g); print "@Word_List\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Seeking a better way to do it
by Tux (Canon) on Feb 01, 2013 at 07:33 UTC | |
Re^2: Seeking a better way to do it
by frozenwithjoy (Priest) on Feb 01, 2013 at 05:22 UTC |