On Thursday 17 January 2002 17:02, Roger C Haslock wrote: > Sorry. > That line should probably be > > foreach (0..$#columns) > > Odd message, though. > - Roger - > > ----- Original Message ----- > From: "Gerry Jones" <[EMAIL PROTECTED]> > To: "Roger C Haslock" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Thursday, January 17, 2002 10:51 AM > Subject: Re: Tables in CGI > > > On Tuesday 15 January 2002 18:00, Roger C Haslock wrote: > > > I was watching this correspondance earlier, and wondering why you are > > not > > > > using fetchrow_hashref. I now wonder why you get all the rows of data > > > bundled into a single array. Does your interface have now way of > > returning > > > > data one row at a time? > > > > > > A simple solution to your problem would go along the lines of > > > > > > my $rows =''; > > > while (@data) # is the array empty yet? > > > { > > > my $row = "\n"; # just to layout the HTML for readability > > > for (0..$#columns) > > > { > > > my $element = shift @data; > > > $row .= td( $element ) > > > } > > > $rows .= Tr($row) > > > } > > > > > > print table({-border=>'1', -align=>'CENTER', -valign=>'TOP'}, > > > Tr({-align=>'CENTER', -valign=>'TOP'}, > > > [ > > > th(\@columns) > > > ] > > > ), > > > $rows > > > ) > > > > I tried your code, but I keep getting (even when I comment out your > > code!): > > "Unrecognized character \xA0 at > > /usr/local/httpd/cgi-bin/CMD/Inv/inv-view.cgi > > > line 101." Line 101 is the "for (0..$#columns)" bit. > > > > Thanks for any help, > > > > Gerry.
I kept getting the same error. This time I realised what was wrong. I checked what character A0 was by doing print chr 160 (160 being the decimal conversion of A0) and got nothing. So I deleted all the whitespace in your snippet and re-formatted the code. Success! The code works flawlessly and does exactly what I wanted! Thanks Roger! Gerry. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]