in reply to Re: RFC: Tie::File::AnyData Lightweight Databases in Perl
in thread RFC: Tie::File::AnyData Lightweight Databases in Perl
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
Hmmm, totally agree, I will try to change that name
Thanks for your comments!
citromatik
|
|---|