Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
... what has got the example to do with CSV?

Well, in fact, a more correct name would be multilineCSV. This module takes several consecutive lines of fields (CSV, tabular, or whatever) that have the same value in a given field (the "key" field") and joins them in one logical record.

Well, I think that it has to do with CSV at least because internally it uses Parse::CSV to parse the lines.

Let's consider the following example:

Mike,5,6 Mike,5,3 John,5,1 John,3,0 Frank,6,1

Using this code:

use Tie::File::AnyData::CSV; tie my @arr,'Tie::File::AnyData::CSV', key=>0, field_sep => ","; print "$arr[0]\n"; ## prints # Mike,5,6 # Mike,5,3 untie @arr; tie my @arr2,'Tie::File::AnyData::CSV', key=>1, field_sep => ','; print "$arr[0]\n"; ## Prints # Mike,5,6 # Mike,5,3 # John,5,1

In the first case, all consecutive lines that have the same value in the first field ("Mike" in the key field), are considered a record. In the second case, all consecutive lines that have the same value in the second field ("5") are considered a record

From Tie::File::AnyData::CSV I would expect to get a tied array of arrays or array of hashes that'd let me access the individual items in the rows. And hopefully the ability to include the record separator within quoted data. Please find a better name for that format.

Hmmm, totally agree, I will try to change that name

Thanks for your comments!


In reply to Re^2: RFC: Tie::File::AnyData Lightweight Databases in Perl by citromatik
in thread RFC: Tie::File::AnyData Lightweight Databases in Perl by citromatik

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (10)
    As of 2019-04-25 16:19 GMT
    Find Nodes?
      Voting Booth?
      I am most likely to install a new module from CPAN if:

      Results (127 votes). Check out past polls.

      • (Sep 10, 2018 at 22:53 UTC) Welcome new users!