Help for this page
|foo|bar|||baz|
s{ (?<! [^|] ) \s* (?! [^|] ) }{0}gx;
$row = join "|", map { s/^\s*$/0/; $_ } split( /\|/, $row, -1 );