J
Jan
Hi!
I have to split a string with a pattern which contains sometimes chars
like + \ (the code is needed in an interpreter, written in Perl, of my
own scripting language, so I never know the pattern exactly).
split(/$pattern/, $string);
It works well most of all time, but if the pattern is + the execution
of the program stops and perl prints an error message.
$pattern = '+';
split(/"$pattern"/, $string); #ok
$pattern = '#';
split(/"$pattern"/, $string); #doesn't work really, but no
error
#occurs
Can anyone tell me how to solve this problem?
I have to split a string with a pattern which contains sometimes chars
like + \ (the code is needed in an interpreter, written in Perl, of my
own scripting language, so I never know the pattern exactly).
split(/$pattern/, $string);
It works well most of all time, but if the pattern is + the execution
of the program stops and perl prints an error message.
$pattern = '+';
split(/"$pattern"/, $string); #ok
$pattern = '#';
split(/"$pattern"/, $string); #doesn't work really, but no
error
#occurs
Can anyone tell me how to solve this problem?