On Mon, 6 Jan 2003 at 15:11, Hughes, Andrew opined:

HA:my $filename = "out.txt";
HA:open(OUTFILE,">$filename");
HA: $stmt = qq { select * from 2002brochurecontest };
HA: $sth = $dbh->prepare ($stmt);
HA: $sth->execute ();
HA: $count = 0;
HA: while (my $row = $sth->fetchrow_hashref())
HA:        {
HA:    print OUTFILE
HA:"$row->{id}|$row->{t}|$row->{f_name}|$row->{l_name}|$row->{w_phone}|$row->{w
HA:_phone_ext}|$row->{division}|$row->{email}|$row
HA:->{eclub}|$row->{country}|$row->{brochure}|$row->{purchase}\n";
HA:         }
HA:        $sth->finish();
HA:close(OUTFILE);

that's fine, but what if your data contains pipes?  you should look into 
one of the csv modules on cpan.  here's one i've used in the past with 
good success:

http://search.cpan.org/author/JWIED/Text-CSV_XS-0.23/CSV_XS.pm

by default, it uses a comma, but you can specify any character to use as 
the delimiter.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to