The two changed lines then become:
my $pattern= "(,|\\||:|>|\\]\\[|_\\|_)"; my @splitted= split /$pattern/,$text;
I know you're trying to stay as close as possible to the OP's code, but as an additional recommendation, for maximum clarity in such a situation one should really follow a cleaner approach like trwww's++ or if using a single hardcoded regex, then taking advantage of the /x modifier and throw in suitable whitespace.
In reply to Re^2: regex trouble
by blazar
in thread regex trouble
by spx2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |