Instead of splitting away what you don't want, consider matching what you want to keep:
my @code = ($id =~ /([^|\\]+|\\[|\\])/g);
Also see Text::CSV_XS.
In reply to Re: Splitting the record using the delimiter
by Corion
in thread Splitting the record using the delimiter
by mariaprabudass
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |