On Tue, May 11, 2004 at 03:01:30PM -0700, Jeff Zucker wrote:
> leegold wrote (off list):
> 
> >So, something like:
> >
> >$dbh->{csv_sep_char}='###';
> >
> >would work, you think?
> 
> Hi,
> 
> First, please respond to the list rather than to an individual.  The 
> individual might be busy :-).  Also, if the answer is on the list, then 
> everyone can learn from it.
> 
> The {csv_sep_char} is a *character* so it could accept '#', but not 
> '###'.  DBD::AnyData allows you to create your own formats though.  If 
> you don't have embedded '###' in your data, then this simple three line 
> module will allow DBD::AnyData to parse files with '###' as a field 
> separator.  Just Save this file under the name 'ThreeSharp.pm' in the 
> AnyData/Format directory where your copy of AnyData is located:
> 
>     package AnyData::Format::ThreeSharp;
>     use base 'AnyData::Format::Base';
>     sub write_fields  { shift; sprintf "%s\n",join '###',@_ }
>     sub read_fields   { split '###', $_[1] }

Should probably be        split '###', $_[1], -1

otherwise trailing empty fields will be removed.

Tim.

Reply via email to