in reply to problem with split function

Since you are using a command line option to specify the delimiter, let me suggest that you try avoiding the use of quotemeta -- even though this happens to be the shortest answer to your original question.

Instead, provide the delimiter string on the command line in such a way that it will be properly interpreted within the script. For example, in bash (or other unix/bourne-like shell), you could do:

your_script -d '\|' foo bar
(or whatever the command line is supposed to look like) -- note that quotation marks are placed around the delimiter string, so that the backslash and vertical bar are passed to the script without being interpreted by the shell. If your script does not use quotemeta, then the regex for the split will be:
/\|/
which is exactly what you want. Now, suppose you really want to use some "magic" regex characters for your delimiter string... e.g. your input file has lines like this:
foo:bar;baz;blork blix etc foo2:bar3;bazx;blrk blx and-so-on
and you need to split on colon, semi-colon and space. The command-line option for the delimiter would then be:
your_script -d '[:; ]' that.file
If you used quotemeta on the delimiter string inside your script, this sort of flexibility would not be possible.