in reply to db2html

Why not using some CSV specialized module for parsing? You'll avoid this way having to handle 'special' cases like another field separator instead '|' or fields that contain the same char as the field separator etc.
here is a simple example using Text::CSV_XS:
#!/usr/bin/perl -w use strict; use Text::CSV_XS (); use CGI '-autoload'; my $csv = Text::CSV_XS->new({sep_char => '|','escape_char' => '\\',}); print start_html(), $/, start_table(); while(my $line = <DATA>) { $csv->parse($line) or next; print $/, start_Tr(), ( map { td(escapeHTML($_)) } $csv->fields() ), end_Tr(); } print $/, end_table(), $/, end_html(), $/; __DATA__ (foo\|bar)&muci++|5m28888kk|020022992 b"loat++\|<bizbaz>|115m28888kk|020022992333 bloat++"\|<bizbaz>|115m28888kk|020022992333 kk|maka\|paka|111kkio433i|kksk43992s3

--
AltBlue.