Oh fellow seekers of wisdom..We shape clay into a pot, but it is the emptiness
inside that holds whatever we want.....
The code below breaks up the @stat_array into fours and then
prints out fields in to an HTML table wih the OCOMsg2 cell in red -
again - just one cell of the emailed table.
print Dumper @stat_array_rows;
sleep 1;
exit;
The boss told me that he wants the WHOLE LINE with the OCOMsg2
in red - so the array below, all the elements -
"ibfarm102 - localtick", 'New York", "hibmis100 - procHKHD2 - Hongkong", "OCOMsg2"
need to be red. print Dumper @stat_array_rows;
sleep 1;
exit;
Is there a way to do this with out rewriting the whole block - I really like this block..
@stat_array = ("ibfarm102 - localtick", "Boston" , "hibmis100 - proc +HKHD2 - Hongkong", "PidMonRsp", "eufarm102 - localtick", "London", "hibmis100 - procHKHD2 - Hongkong +" , "PidMonReq" , "ibfarm102 - localtick", "New York" , "hibmis100 - procHKHD2 - Hongk +ong", "PidMonRsp", "ibfarm102 - localtick", 'New York", "hibmis100 - procHKHD2 - Hongko +ng", "OCOMsg2"); my @stat_array_rows = @stat_array; while (my @stat_array_rows = splice(@stat_array_rows, 0 , 4)) { print MAIL "<tr>\n"; for my $stat_row(@stat_array_rows) { #if ($stat_row eq $config_msgtype){ if ($stat_row =~/OCAlive2/){ print MAIL "<td><font color=red>$stat_row[0]</font></td>\n"; } else { print MAIL "<td>$stat_row</td>\n"; } } print MAIL "</tr>\n"; }
this are the results of the block:
<tr> <td>ibfarm102 - localtick </td> <td> Boston</td> <td> hibmis100 - procHKHD2 - Hongkong </td> <td>PidMonRsp</td> </tr> <tr> <td>eufarm102 - localtick </td> <td>London</td> <td> hibmis100 - procHKHD2 - Hongkong </td> <td>PidMonReq</td> </tr> <tr> <td>ibfarm102 - localtick </td> <td>New York</td> <td> hibmis100 - procHKHD2 - Hongkong </td> <td>PidMonRsp</td> </tr> <tr> <td>ibfarm102 - localtick </td> <td>New York</td> <td> hibmis100 - procHKHD2 - Hongkong </td> <td>OCOMsg2</td> </tr>
this is the data Dumper
print Dumper @stat_array $VAR1 = [ 'ibfarm102 localtick', ' Greenwich', ' hibmis100 procHKHD2 Hongkong ', 'PidMonRsp' ]; print Dumper @stat_array_rows. $VAR1 = 'ibfarm102 localtick'; $VAR2 = ' Greenwich'; $VAR3 = ' hibmis100 procHKHD2 Hongkong '; $VAR4 = 'PidMonRsp';
In reply to perl generated table - format color by casperdaghost
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |