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 7021875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:30:26+00:00 2026-05-27T23:30:26+00:00

having another problem with perl and regex, sorry for being a badass perl noobie

  • 0

having another problem with perl and regex, sorry for being a badass perl noobie 😉

I get the whole programm output via backticks in the variable $output.

My regex matches always just for the first appearing in the output but not for every appearance..

/g didn’t work either..

$output = `$calling 2>>bla.txt`;

if ($output =~ m/SegmentMean .+ Likelihood: ([-+]?\d+\.?\d+)/g) {
    print "$1\n";
}

Outputs from the Java Output is:

SegmentMean 0 Likelihood: -7.138117738068088
SegmentMean 1 Likelihood: -11.508156736772925
SegmentMean 2 Likelihood: -10.424706822552386
SegmentMean 3 Likelihood: -9.560308776447586
SegmentMean 4 Likelihood: -9.26826400149502
SegmentMean 5 Likelihood: -9.524685714290996
SegmentMean 6 Likelihood: -8.360030637461975
SegmentMean 7 Likelihood: -8.163275211919945
SegmentMean 8 Likelihood: -7.917569593466525
SegmentMean 9 Likelihood: -9.043243571260344

Up to SegmentMean 20 ..

  • 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-27T23:30:26+00:00Added an answer on May 27, 2026 at 11:30 pm

    Try going through the matches like an array (and use a better regex):

    while ($output =~ m/SegmentMean \S+ Likelihood: ([-+]?\d+(\.\d+)?)/g) {
        print "$1\n";
    }
    

    That should work.

    You can even turn it into a single line:

    print "$1\n" while ($output =~ /SegmentMean \S+ Likelihood: ([-+]?\d+(?:\.\d+)?)/g);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I saw the other topic and I'm having another problem. The process is starting
I'm having another problem with this exercise: http://lpmj.net/20.php My problem is that when i
I'm having another fun problem with Rhino Mocks. Can anyone answer this one: Here's
This question is another problem im having with my application which is described here
I am having another problem with my table and checkboxes. I ahve gotten my
I am having another problem with my android app which I can't find an
I am having another problem with my HttpModule that handles exceptions. (cfr. my previous
After getting the right answer from this question , I am having another problem
having another problem with my javascript for my table. Basically, if you look at
Okay, I am having another UITableView problem. For some reason the indexPath.row is all

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.