Hey,

In regional settings all this country uses semicolon instead comma as CSV separator so I need to replace default comma separator with semicolon. I use Spreadsheet::Read module.

#!/usr/bin/perl use strict; use Pod::Usage; use Getopt::Std; use Spreadsheet::Read; use Spreadsheet::WriteExcel; my $ref = ReadData ("test.csv");

While this works for any XLS file I have problems with CSV files. The $ref variable remains empty. I even added use Text::CSV_XS (or Text::CSV_PP) but $ref remained empty.

Then I modified the last line:

my $ref = ReadData ("test.csv", sep => ';');

or

my $ref = ReadData ("test.csv", sep => ';',quote => '"');

Before I type the last line debugger reports the following error (in the line with one or both arguments):

Too many arguments for Spreadsheet::Read::ReadData

The CSV parsing module theoretically should detect separator - but it doesn't. I'm out of ideas.

Thanks in advance for your help!


In reply to Parsing CSV table by JackVanRamars

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.