$ perl -le'my @field = grep ++$i%2, split /(\|)/, "2|3|||||"; push @field, "" unless $i%2; print @field' 2 : 3 : : : : :