I rememeber sometimes doing something like this when
using CGI.pm and DBI.pm
push(@rows,td({-colspan=>'6',-bgcolor=>'#FFFFFF'},[$th]));
#blank row
$th = ' ';
push(@rows,td({-colspan=>'6',-bgcolor=>'#FFFFFF'},[$th]));
push(@rows,td({-bgcolor=>'#FFCC99'},['',b('Verwijderen:'),b('Naam:'),b('Voornaam:'),b('Vertegenwoordiger:*'),b('Bekijk
CV:')]));
while (@data = $cursor->fetchrow) {
$count++;
if ($count % 2 == 0){
$bgcolor = "#FFCC99";
}else{
$bgcolor = "#FFFFFF";
}
etc..
and then i the end i printed the table
$innertable = table({-border=>'0',-width=>'100%',
-cellspacing=>'1', -cellpadding=>'2',
-bgcolor=>'#FFFFFF'},Tr(\@rows));
I always founded this a very nice feature of CGI.pm.
The only thing i never found out is how you could
manipulate tables in this same kind of way ?
Thanks,
Dirk
--- Peter Kappus <[EMAIL PROTECTED]> wrote:
> Another neat trick I use to get subroutine arguments
> is the old "shift"
> function without an argument.
>
> Since, @_ is the default array in a subroutine you
> can just say
>
> my $firstParm = shift; #shift off the first arg from
> @_
>
>
> Therefore,
>
> print add(30,50);
>
> sub addTwo{
> my $firstNum = shift;
> my $secondNum = shift;
> return $firstNum + $secondNum;
> }
>
> will print "80". neato eh?
>
> another fun trick if you have, say, 3 arguments is
> to say
>
> my ($name, $size, $color) = @_;
>
> this will map the first three args in your args
> array two the variables
> $name, $size, and $color.
>
> I hope this is useful...
>
> -PK
>
> -----Original Message-----
> From: zentara [mailto:[EMAIL PROTECTED]]
> Sent: Friday, November 22, 2002 6:33 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Changing row color with subroutine
>
>
> On Fri, 22 Nov 2002 03:28:39 -0800,
> [EMAIL PROTECTED] (Poster) wrote:
>
> >Hi, I am having a little trouble with a sub that is
> using the modulus
> >operator.
>
> Yeah, it fooled me too for a bit :-)
> The problem is the way you pass the value to the
> sub, @_ always is 1, the count of elements in @_.
> Change @_ to @_[0] or better yet $_[0]
>
> >--here is the sub
> >sub color_rows
> >{
> >my $num = @_;
>
>
> --
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus � Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]