my $delim = qr/\|/; my $line = "a||c|\t| |d||e"; my @fields = split($delim, $line);
The qr operator quotes and compiles its STRING as a regular expression.
split splits on a pattern (regex).
update:
Added explanation.
In reply to Re^4: identifying null fields in bar delimited records
by wfsp
in thread identifying null fields in bar delimited records
by jjohhn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |