Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I highlight the last row of an HTML table generated using Perl?
    text
    copied!<p>The code below breaks up the @stat_array into fours and then prints out fields into an HTML table with the OCOMsg2 cell in red - again - just one cell of the emailed table.</p> <p>The boss told me that he wants the WHOLE LINE with the OCOMsg2 in red - so the array below, all the elements</p> <pre><code>"ibfarm102 - localtick", 'New York", "hibmis100 - procHKHD2 - Hongkong", "OCOMsg2" </code></pre> <p>need to be red. </p> <p>Is there a way to do this with out rewriting the whole block - I really like this block.</p> <pre><code>@stat_array = ("ibfarm102 - localtick", "Boston" , "hibmis100 - procHKHD2 - Hongkong", "PidMonRsp", "eufarm102 - localtick", "London", "hibmis100 - procHKHD2 - Hongkong" , "PidMonReq" , "ibfarm102 - localtick", "New York" , "hibmis100 - procHKHD2 - Hongkong", "PidMonRsp", "ibfarm102 - localtick", 'New York", "hibmis100 - procHKHD2 - Hongkong", "OCOMsg2"); my @stat_array_rows = @stat_array; while (my @stat_array_rows = splice(@stat_array_rows, 0 , 4)) { print MAIL "&lt;tr&gt;\n";while (my @stat_array_rows = splice(@stat_array_rows, 0 , 4)) { print MAIL "&lt;tr&gt;\n"; for my $stat_row(@stat_array_rows) { if ($stat_row =~ /OCCOMsg2/){ print MAIL "&lt;td&gt;&lt;font color=red&gt;$stat_row[0]&lt;/font&gt;&lt;/td&gt;\n"; } else { print for my $stat_row(@stat_array_rows) { if ($stat_row =~/OCAlive2/){ print MAIL "&lt;td&gt;&lt;font color=red&gt;$stat_row[0]&lt;/font&gt;&lt;/td&gt;\n"; } else { print MAIL "&lt;td&gt;$stat_row&lt;/td&gt;\n"; } } print MAIL "&lt;/tr&gt;\n"; } </code></pre> <p>these are the results of the block:</p> <pre><code>&lt;tr&gt; &lt;td&gt;ibfarm102 - localtick &lt;/td&gt; &lt;td&gt; Boston&lt;/td&gt; &lt;td&gt; hibmis100 - procHKHD2 - Hongkong &lt;/td&gt; &lt;td&gt;PidMonRsp&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;eufarm102 - localtick &lt;/td&gt; &lt;td&gt;London&lt;/td&gt; &lt;td&gt; hibmis100 - procHKHD2 - Hongkong &lt;/td&gt; &lt;td&gt;PidMonReq&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;ibfarm102 - localtick &lt;/td&gt; &lt;td&gt;New York&lt;/td&gt; &lt;td&gt; hibmis100 - procHKHD2 - Hongkong &lt;/td&gt; &lt;td&gt;PidMonRsp&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;ibfarm102 - localtick &lt;/td&gt; &lt;td&gt;New York&lt;/td&gt; &lt;td&gt; hibmis100 - procHKHD2 - Hongkong &lt;/td&gt; &lt;td&gt;&lt;font color=red&gt; OCOMsg2&lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>I somehow want Perl to print everything i the OCOMsg2 block red, not just that cell.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload