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

  • SEARCH
  • Home
  • 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 8521343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:47:50+00:00 2026-06-11T06:47:50+00:00

I am trying to write this script in Perl to check for a unique

  • 0

I am trying to write this script in Perl to check for a unique string inside the variable $summary from my query results. There is multiple similar entries like this but part of them are unique (db1node1web1 could be different nodes but same result type). This is only a small part of the code to check if I using Reg Ex correctly (not true currently).

I included the code below:

$summary = "NFW - CRITICAL CPU_Load_db1node1web1 CRITICAL - load average: 114.49, 48.55, 29.17 Sept 01 00:10:16 PDT 2012";
if ( $summary =~ "NFW - CRITICAL CPU_Load_[a-z]* CRITICAL - load average: 114.49, 48.55, 29.17 Sept 01 00:10:16 PDT 2012") {
    print "True\n";
}else {
    print "False\n";
}

I am very bad with Perl and trying to get this working so I can dissect my query results.

  • 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-06-11T06:47:52+00:00Added an answer on June 11, 2026 at 6:47 am

    It’s been a few years since I’ve coded in perl, but IIRC, don’t you have to specify whether it’s a match or substitution? And you need to include numbers

    I believe your code should be:

    $summary = "NFW - CRITICAL CPU_Load_db1node1web1 CRITICAL - load average: 114.49, 48.55, 29.17 Sept 01 00:10:16 PDT 2012";
    if ( $summary =~ m/NFW - CRITICAL CPU_Load_[a-z0-9]* CRITICAL - load average: 114.49, 48.55, 29.17 Sept 01 00:10:16 PDT 2012/) {
        print "True\n";
    }else {
        print "False\n";
    }
    

    Reference: http://www.troubleshooters.com/codecorn/littperl/perlreg.htm

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

Sidebar

Related Questions

I'm trying write a simple perl script that reads some fields from a password
I am trying to write a script in Perl that generates URL list from
I'm trying to write a perl script that removes whitespace from XML tags, but
I'm trying to write a batch script, this script is responsible to launch a
I am trying to write a python script that takes record data like this
I am trying to write my very first python script. This was working but
I am trying to write regular expression for this pattern: String word=113(112,9); It should
I am trying to write a simple Perl script that reads a *.csv, places
Trying to figure this out. I am trying to execute a perl script within
I'm trying to write a perl script than can open a dir and delete

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.