in reply to HTML::Table multi-row head

Update: This is piffle. Follow simonm's advice.
You want an array reference, as used in the docs. They can be created using the square bracket notation thusly:
my $array_ref = ["foo", "bar", "baz"];
Note that $array_ref is a scalar. To use it in your context:
my $table = new HTML::Table ( -border => 1, -rules => 'both', -spacing => 0, -padding => 3, -align => 'CENTER', -style => 'text-align: right;', -width => '100%', -head => [$sth->{NAME}, "foo", "bar", "baz", "whatever"], -data => $data, );

davis
It wasn't easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.

Replies are listed 'Best First'.
Re^2: HTML::Table multi-row head
by simonm (Vicar) on Jan 06, 2005 at 17:15 UTC
    I think that $sth->{NAME} is already an array reference.

    If you want multiple heading rows I think the OP will need to add them after the new() call:

    $table->addRow(@second_header); $table->setRowHead(-1);
      It does not work, however... Since I lack good imagination I tested that code by doing this:
      $table->addRow($sth->{NAME});
      $table->addRow($sth->{NAME});
      $table->setRowHead(-1);
      
      But my script suddenly failed to load. In the background two instances of perl.exe are running and the browser fails to load the table anymore.

        You could try the following:

        $table->addRow( @{$sth->{NAME}} ); $table->setRowHead(1); $table->addRow( @{$sth->{NAME}} ); $table->setRowHead(2);

        However, I'm not sure what the exact problem is here. Please try checking your server error log to see if any useful messages are being generated.

      In a word, d'oh. You may ignore my demented ramblings.


      davis
      It wasn't easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.