in reply to Split on comma without whitespace after
my $str ="word1,word2, word3,word4,word5"; my @arr = split /,(?=\S)/, $str;
The code above is a look-ahead; see perlre for more info (look at the chapter on "Look-Around Assertions" there).
Rata
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Split on comma without whitespace after
by moritz (Cardinal) on Nov 26, 2010 at 16:32 UTC |