in reply to creating HTML table
If you have a problem with the template system, tell us what it is ;)
If you insist on implementing it as you did, you can either use a counter or $. to determine the line number of the input file handle, and then test with if ($. % 2 == 0) if the number is even.
You could do something like:
my $line = 1; while (<data>){ my $class = ($line % 2) == 0 ? "even" : "odd"; print qq{\t\t\t<tr class="$class">}; # rest of the loop here $line++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: creating HTML table
by shmem (Chancellor) on Jul 16, 2007 at 09:06 UTC | |
by GertMT (Hermit) on Jul 16, 2007 at 10:12 UTC | |
by Cody Pendant (Prior) on Jul 16, 2007 at 10:29 UTC | |
by holli (Abbot) on Jul 16, 2007 at 10:39 UTC | |
by Cody Pendant (Prior) on Jul 16, 2007 at 12:33 UTC | |
by GertMT (Hermit) on Jul 16, 2007 at 12:58 UTC | |
|
Re^2: creating HTML table
by justinhimt (Initiate) on Apr 27, 2014 at 08:47 UTC | |
by marto (Cardinal) on Apr 27, 2014 at 09:06 UTC |