perl -le '$_="foo;bar:quux-blorflydick";my $p = "[".shift()."]"; print + "@{[split/$p/,$_]}"' ';:y-' foo bar quux blorfl dick
Yes. It's possible. Just make your split chars into a character class and use that in split (escaping meta-chars where necessary).
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re: splitting a line by user-defined separators
by shmem
in thread splitting a line by user-defined separators
by a11
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |