in reply to split problem when emptiness is a valid element

You could ask split to give you the delimeters. To do that, wrap your delimiter in parens:
my @result = split( /(\|)/ );
Then you get (for example):
[ 'A', '|', 'B', '|', '|', '|' ]
This may or may not be easier to handle than other solutions already given.

Phil