in reply to Broken regexp

To borrow a concept from Juerd's comment, you could try the following, using zero-width look-ahead & look-behind assertions.
$line =~ s/(?<=\|)(?=\|)/\\N/g;
-jbWare