Just add parens:
and the delimiters will be captured ... but why put them in another array? Surely you won't be able to line them back up again ...split /(:|%|;)/
Update: regardless of why, you could do something like so:
Where @a would contain the delimiters and @b contains the data .../\W/ ? push @a,$_ : push @b,$_ for split /(:|%|;)/
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re: Split at multiple delimiters and get the delimiter
by jeffa
in thread Split at multiple delimiters and get the delimiter
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |