Use
quotemeta. This will escape all non-alphanumeric characters. The problem you are running into is the "|" is being interpreted as an "or" in the regex, so you split at "nothing" or "nothing", so it splits the string at every character(equivalent to
split(//, $str).
Code Sample:
my $str = "1|2|3";
my $delimiter = #get delimiter
$delimiter = quotemeta($delimiter);
print "$_\n" foreach(split(/$delimiter/, $str));
__OUTPUT__
1
2
3