in reply to Why do I get regexp chars in split?
You don't want (capturing) parentheses, you want square brackets (a character class, see perlre):
my $string = "foo / bar & etc"; my @parts = split(m# [&/] #,$string); print join("\n",@parts,"");
(Note the extra null string to tack a newline onto the "etc", and the use of a different matching delimiter to avoid the need to escape the forward slash -- the ampersand never needed to be escaped )
|
---|