But it will only detect the field delimiter if it is a TAB or a COMMA:
_FDelimiter is the field delimiter between field names in the header row (if any) and also between fields in the body of the file. If undef, read() will try to guess whether it is tab "\t" or comma <",">, and set this parameter accordingly. If there is only one field in the file, then comma is assumed by read() and will be used by write().

To guess the delimiter, the program looks for the first comma or tab character in the header row (if present) or in the first record. Whichever character is found first is assumed to be the delimiter.

If you don't want the program to guess, or you have a data file format that uses a custom delimiter, specify the delimiter explicitly in the object or when calling read() or make a subclass that initializes this value differently. On write(), this will default to comma if it is empty or undef.

Its use is therefore fairly limited if you venture outside of the world of the comma- or tab-separated type of files.

A somewhat more flexible module is Text::CSV::DetectSeparator which can distinguish between the following delimiters , ; . : # (it strangely omits the tab-delimiter).

Text::CSV::Separator is even more flexible. Its standard list of delimiters is , ; : | \t, but it accepts a list of other candidates and can even use an "excluded" list of characters.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James


In reply to Re^2: what type of deliminator is used in tabular file. by CountZero
in thread what type of deliminator is used in tabular file. by wst

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.