Good follow-up, and here's a snippet:
sub parse_line {
my $line = shift;
chomp($line);
print "LINE: $line<br>\n" if $debug;
my %record;
my $entry;
my $i = 1; # First index
while ($line) {
if ($line =~
s {
^\"
((?:[^\"]|\"\")*)
\"
(?:,|$)
} {}x) {
$entry = $1;
} elsif ($line =~
s {
^
(.*?)
(?:,|$)
} {}x) {
$entry = $1;
} else {
die "Can't parse the line $line";
}
$entry =~ s/\"\"/\"/g;
$record{$i++} = $entry;
}
return \%record;
}
Thanks.
Tim Johnson <[EMAIL PROTECTED]> wrote:
We might need a little code if we're going to help. As far as I know there are no
CSV-HTML gotchas that would do this, so it's probably your algorithm. Are you doing
something like this?
if($my_var){
print $my_var;
}
that would print nothing if the value was a zero, because zero evaluates to FALSE.
-----Original Message-----
From: Gregg O'Donnell [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 05, 2004 8:38 AM
To: [EMAIL PROTECTED]
Subject: * CSV to HTML * zero reads as empty space
I have a script that reads a CSV file into an HTML template. The template reads the
CSV data accurately unless the field shows zero, in which case the HTML page displays
a blank space. Any suggesstions? Thanks!
---------------------------------
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online
---------------------------------
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online