Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have an array @a, in which i have 3 rows in the $a[0], 2 rows in $a[1] and $a[2] as shown below.
<th><rowspan=2>Target protein</th> <th><colspan=2>Purified protein concentration</th> <th><rowspan=3>Activity</th> <th>Mg/liter culture</th> <th>Mg/g dry cell weight</th> <th>Mg/liter culture</th> <th>Mg/g dry cell weight</th>
What i want to do is, if $a[0] has rowspan=2 then we have to place one empty <th></th> in the corresponding place of $a[1], likewise if rowspan=3 the we have to place empty <th></th> in $a[0] and $a[1] in corresponding place.
output: <th><rowspan=2>Target protein</th> <th><colspan=2>Purified protein concentration</th> <th><rowspan=3>Activity</th> <th></th> <th>Mg/liter culture</th> <th><rowspan=2>Mg/g dry cell weight</th> <th></th> <th>Mg/liter culture</th> <th>Mg/g dry cell weight</th> <th></th> <th></th>
I tried by splitting newline characters and by using the index value of the newarray i assigned the empty cell in the next $a[1]. But i could not able to get the correct solution. Is there any other way to do this.
20050426 Janitored by Corion: Fixed formatting and inline <th> tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: array manipulation
by ZlR (Chaplain) on Apr 26, 2005 at 10:11 UTC | |
|
Re: array manipulation
by Jaap (Curate) on Apr 26, 2005 at 09:50 UTC | |
|
Re: array manipulation
by Cody Pendant (Prior) on Apr 26, 2005 at 10:36 UTC |