in reply to pipe delimited file problem

You can use a zero-width positive look behind, like this:
use strict; use strict; while (<DATA>) { s/(?<=\|)\|/empty|/g; print; } __DATA__ |a||| |||| |||a|
I usually find it easier to maintain code that uses split though.