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
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
|
---|
In Section
Seekers of Perl Wisdom