nkuduva has asked for the wisdom of the Perl Monks concerning the following question:
Thanks# Input string is "ab''c" and ' is the delimiter for split. # After "ab" there are two delimiters, hence split returns # an array with 3 elements as show in the output below. # But I want output to have 4 elements instead of 3. One # empty array element for every delimiter split encounters my @arr1 = split("'", "ab''c"); print Dumper(@arr1); Output: $VAR1 = 'ab'; $VAR2 = ''; $VAR3 = 'c'; I want the output to be $VAR1 = 'ab'; $VAR2 = ''; $VAR3 = ''; $VAR4 = 'c';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Split with consecutive delimeters
by jethro (Monsignor) on Nov 01, 2013 at 00:27 UTC | |
by nkuduva (Novice) on Nov 01, 2013 at 00:35 UTC | |
|
Re: Split with consecutive delimeters
by choroba (Cardinal) on Nov 01, 2013 at 00:16 UTC |