in reply to Using variable in substitute regex producing odd results

The pipe character "|" is a regex metacharacter, so your regex becomes "match nothing or nothing" which, with the /g modifier, is effectively equivalent to matching at the boundary between every adjoining character in your string. The generic solution for this is to escape the string within the regexp:
$line =~ s/\Q$delimeter\E/,/g;