[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

: Charles K. Clarkson [CKC], on Thursday, September 9, 2004 at
: 17:37 (-0500) thinks about: 
: 
: : : print table(
: :         {-border=>>undef},
: : :         caption('Choose your favourite brand:'),
: : :         Tr({-align=>CENTER,-valign=>TOP},),
: 
: :     That doesn't look right. Are CENTER and TOP constants?
: : If not, you don't have warnings turned on.
: 
: i've turned warnings and everythings ok it prints me out:
: <table border><caption>Choose your favourite brand:</caption>
: <tr align="CENTER" valign="TOP" />

   Hmph. You're right. It's a 'strict' error.

#!/usr/bin/perl

use strict;
use warnings;

use CGI 'Tr';

print Tr({-align=>CENTER,-valign=>TOP},);

__END__

Bareword "CENTER" not allowed while "strict subs" in use at aa.pl line 8.
Bareword "TOP" not allowed while "strict subs" in use at aa.pl line 8.


: : :         td($items[0], $items[1], $items[2]),
: : :         td($items[3], $items[4], $items[5])
: : :         );
: : : #...
: : : 
: : : But how to do that inside while loop? Can I use
: : : table() function, or I have to print it (like
: : : without CGI module)?
: 
: :     I don't understand the question. What while loop?
: : What would it be looping over?
: 
: I want print all items into table, table should have 3 columns.
: I don't know how to do it.

    But your file only seems to have 6 fields in it. Where is
the data for the other fields coming from and what is be looped
over in the while loop?

    Closer inspection shows the above code doesn't work (right).
I think you wanted this.

use CGI qw( table Tr td caption );

my @items = ( 1 .. 6 );
print
    table(
        caption( 'Choose your favourite brand:' ),
        Tr(
            { -align  => 'CENTER',
              -valign => 'TOP'    },
            td( @items[0 .. 2] ),
            td( @items[3 .. 5] )
        )
    );


    Which produces something like this (edited).

<table>
  <caption>Choose your favourite brand:</caption>
  <tr valign="TOP" align="CENTER">
    <td>1 2 3</td>
    <td>4 5 6</td>
  </tr>
</table>



HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to