in reply to Re: Chomp is removing the whole word instead of the newline
in thread Chomp is removing the whole word instead of the newline
So, I was quite frustrated with this easy looking task bugging me for the whole day long. I really appreciate everyone who responded.
Finaly I ended up using Text::CSV perl module and then calling each of the CSV field as array reference. There was no need left to run the chomp after using Text::CSV.
Here is the code:
#!/usr/bin/perl use warnings; use strict; use Text::CSV; my $csv = Text::CSV->new ( { binary => 1 } ) # should set binary attr +ibute. or die "Cannot use CSV: ".Text::CSV->error_diag (); open my $fh, "<:encoding(utf8)", "vm.csv" or die "vm.csv: $!"; <$fh>; ## this is to remove the column headers. while ( my $row = $csv->getline ($fh) ) { print $row->[1]; }
and here is hte output:
fd1fd2fd3fd4
Later i was pulled these individual values and inserted into the DB.
Thanks everyone.
|
|---|