I faced a problem using Perl. I get the data from CSV using
-
$csv = "test.csv";
-
open(DAT, $csv) || die("Cannot Open File");
-
-
while (<DAT>) {
-
-
my @new = ();
-
-
push(@new, $+) while $_ =~ m{
-
"([^\"\\]*(?:\\.[^\"\\]*)*)",?
-
-
| ([^,]+),?
-
-
| ,
-
}gx;
-
-
push(@new, undef) if substr($_, -1,1) eq ',';
-
print "$_\n" for @new;
-
}
-
my test data in excel(convert to csv) is:
a,a123,abc
b,b123,bcd
c,c123,cde
then my result shown is
a
a123
abc
b
b123
bcd
c
c123
cde
What I am wondering is that how can I assign the result "a"-->Name, "a123"-->contact_no, "abc"-->address. Same for b and c.