in reply to words with numbers in them
If your definition of "word" in this case, is non-whitespace characters separated by whitespace, then I'd split on white space, then grep the resulting array for elements containing numbers.
my $names = "1Petrus2 Joh4an Smit 2johnny99 Julius 789"; my @words = split /\s+/, $names; my @numwords = grep /\d/, @words;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: words with numbers in them
by facebook (Initiate) on Jul 31, 2018 at 19:19 UTC | |
by tybalt89 (Monsignor) on Jul 31, 2018 at 20:58 UTC | |
by facebook (Initiate) on Aug 01, 2018 at 14:09 UTC | |
by tybalt89 (Monsignor) on Aug 02, 2018 at 01:35 UTC |
In Section
Seekers of Perl Wisdom