in reply to Get unique fields from file
The first argument of split is a regex, not a string. "|" is an alternative of two empty strings.
If you want to split on the literal vertical bar, you need to backslash it.my @fields = split "|", 'abc|def'; print join ', ', @fields; # a, b, c, |, d, e, f
my @fields = split /\|/, 'abc|def'; print join ', ', @fields; # abc, def