Gossamer Forum
Home : General : Perl Programming :

Good CSV Module?

Quote Reply
Good CSV Module?
Does anyone know of a good CSV module, that allows for the writing, and extraction of a CSV file/to screen?

I tried writing something myself that would do a similar task (for a script im writing), but there are some odd \n's
appearing out of nowhere, and its really getting on my nerves!

Anyone got any suggestions? Or, any input on why I'm getting extra newlines entered from this code;

Code:
while (my $hit = $sth->fetchrow_hashref) {

my $short = GT::CGI::html_escape($hit->{short});
$short =~ s/\n/<BR>/g;
my $full = GT::CGI::html_escape($hit->{full});
$full =~ s/\n/<BR>/g;

$saved .= $hit->{title} . $delimiter . $short . $delimiter . $full . $delimiter . $hit->{date} . $delimiter . $hit->{nice_date} . "\n";
}

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Good CSV Module? In reply to
Try changing your regexs to:

$var =~ s/\cM\cJ?/<BR>/sg;

Last edited by:

Paul: Sep 16, 2002, 6:24 AM
Quote Reply
Re: [Paul] Good CSV Module? In reply to
Wow....worked a charm! MAy I ask what those regex's actually do? I'm not sure about the \cM\cJ?/ part ;)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!