T
tsotsi
Does anyone know of any bug in ParseWords? I have an input string that
I want to split on the pipe using ParseWords since split removes
trailing pipes with empty data.
code
---------------------------------------------------------------------------------------------------------------------
use Text:arseWords;
open(INPUT,"testdata.txt");
while (<INPUT>)
{
chomp;
my @fields = Text:arseWords:arse_line( qr(\|), 0,$_);
print "==$_==\n";
print "field0=$fields[0]\n";
print "field1=$fields[0]\n";
print "field2=$fields[0]\n";
print "field3=$fields[0]\n";
}
close(INPUT);
---------------------------------------------------------------------------------------------------------------------
I get the following when I run it
---------------------------------------------------------------------------------------------------------------------
perl qwe.pl
==641.59 $' 19|641.59 B|TX725.H1
B49|-|1364|1|DEAN|1|TOWN|COOK|0|0|19971126|641.59 B|==
field0=
field1=
field2=
field3=
I want to split on the pipe using ParseWords since split removes
trailing pipes with empty data.
code
---------------------------------------------------------------------------------------------------------------------
use Text:arseWords;
open(INPUT,"testdata.txt");
while (<INPUT>)
{
chomp;
my @fields = Text:arseWords:arse_line( qr(\|), 0,$_);
print "==$_==\n";
print "field0=$fields[0]\n";
print "field1=$fields[0]\n";
print "field2=$fields[0]\n";
print "field3=$fields[0]\n";
}
close(INPUT);
---------------------------------------------------------------------------------------------------------------------
I get the following when I run it
---------------------------------------------------------------------------------------------------------------------
perl qwe.pl
==641.59 $' 19|641.59 B|TX725.H1
B49|-|1364|1|DEAN|1|TOWN|COOK|0|0|19971126|641.59 B|==
field0=
field1=
field2=
field3=