Re: How to remove trailing commas and points from a CSV file ?



Hi dear Yitzle:

Thank you very much for you suggestion about the sustitution of the
code, required to treat separately the CSV file (from the perl code).

It has worked flawlessly :-)

Thank you (all) very much

Regards

On 26/06/2008, yitzle <yitzle@xxxxxxxxxxxxxxxxxxxxx> wrote:
On Thu, Jun 26, 2008 at 1:14 PM, <perez.erasmo@xxxxxxxxx> wrote:
Hi dear Jeff:

Thank you very much for your help

Yiur script is working flawlessly

Just another question:

How could I re-write your script in order to treat the __DATA__
portion of your code as an external file ?

I happen to have the whole CSV file and I would not want to mix
directly with it, but to reference it from the perl code

How could I accomplish that ?

Should I substitue the <DATA> for the name of the CSV file in the perl
code ?

Thank you very much for any help

Regards

Erasmo

Replace:
while(<DATA>) {
with
while( <> ) {
and then call the script like:
script.pl datafile
or replace it with
open( my $fileHandle, "< datafile" ) or die;
while( <$fileHandle> ) {

.



Relevant Pages

  • Re: splitting cvs file and insert in mysql via DBI
    ... > or a number in csv file. ... Perl says that it find an a number or a dot ... How, *exactly*, are you calling this script? ... That error message would ...
    (comp.lang.perl.misc)
  • Question about creating variables from a CSV file
    ... done with PERL that I don't want somebody to do with Excel or Miserable ... The part I can't seem to get going has to do with making variables out ... of the header row in the CSV file. ... write the output to a new CSV file. ...
    (perl.beginners)
  • Re: Arrays, Dates, Indexing and Initialisation
    ... I have read Beginning Perl and a bit of Intermediate Perl, though was able to solve individual problems, but I was not sure,if I can code myself out of a wet paperbag. ... There is a date column in that csv file ... You should use common patterns where possible so that your code will be easier to understand. ...
    (perl.beginners)
  • Re: Hard or Easy? To find string, then grab criterion matched lines above and below?
    ... Here is my perl script solution so far - at the end of this post. ... I have replaced your paralell hashes by a has containing records. ... into the CSV file, ie. "Checking Netmeeting - Disable Remote Desktop ... You managed to pull out the CSR with a pattern. ...
    (comp.lang.perl.misc)
  • Re: splitting cvs file and insert in mysql via DBI
    ... Xaver Biton wrote: ... Perl says that it find an a number or a dot ... It could be that some fields now in the csv file are empty? ... exists a variable in the execute statement for every value (also the ...
    (comp.lang.perl.misc)