Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6184545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:33:18+00:00 2026-05-24T01:33:18+00:00

The code below breaks up the @stat_array into fours and then prints out fields

  • 0

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.

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.

Is there a way to do this with out rewriting the whole block – I really like this block.

@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 "<tr>\n";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 =~ /OCCOMsg2/){
        print MAIL "<td><font color=red>$stat_row[0]</font></td>\n";
      }
     else {
        print  for my $stat_row(@stat_array_rows) {
            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";
}

these 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><font color=red> OCOMsg2</font></td>
</tr>

I somehow want Perl to print everything i the OCOMsg2 block red, not just that cell.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:33:19+00:00Added an answer on May 24, 2026 at 1:33 am

    When you have the data in @stat_array_rows (a rather badly named variable in my opinion as it only contains a single row at a time) you just need to check if any of the elements contains ‘OCOMsg2’ and set a flag which you can use within the rest of the code.

    my $is_OCOMsg2 = grep { /OCOMsg2/ } @stat_array_rows;
    

    Also. This is 2011. People don’t use the FONT tag any more. You should use CSS for this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a plot (sample code pasted below) that I am trying to add
I would like to implement a bidirectional fifo. The code below is functioning but
My below toggle() breaks when I uncomment the line $('.comments').slideUp('slow'); in the effects chain
In the code below is using getLevel() . where can I find it (it
Please review the example code below, I have a class file that is loaded
I can get it to remove all the question marks with the code below:
I have a basic PHP question, take the code below for example, let's say
Virtually every code example out there reads a TXT file line-by-line and stores it
I have an HTML page with some <code> segments, and I have given them
I have the code below to open a pop up when user makes a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.