The code you posted doesn't produce the output you posted. However, it does seem to do what you want. So you haven't posted the portion of your code that is producing the problem. The following code was modified only in the formatting of its output, and where we're taking input from. Aside from that it's your code:
use strict; use warnings; my $sum = 0; while (my $line = <DATA>) { chomp $line; print "Original data:[$line]\n"; my ($target,$variables) = split (/;/ , $line); print "\t$target\n"; print "\t$variables\n"; } __DATA__ planet;World|Earth planet;celestial body|moon psychology;therapy|sociology psychology;humanity|sociology
...produces...
Original data:[planet;World|Earth] planet World|Earth Original data:[planet;celestial body|moon] planet celestial body|moon Original data:[psychology;therapy|sociology] psychology therapy|sociology Original data:[psychology;humanity|sociology] psychology humanity|sociology
Where's the problem?
Dave
In reply to Re: Parse csv file line by line
by davido
in thread Parse csv file line by line
by albascura
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |