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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:37:52+00:00 2026-05-11T22:37:52+00:00

The following is the data I am working on: __DATA__ Node 1: 98 debug

  • 0

The following is the data I am working on:

__DATA__

Node 1: 

        98 debug : fill 100 
       102 debug : fill 104
Node 2:

        88 debug : fill 120 
       152 debug : fill 164

I want to write a regex/(or whatever is appropriate) to capture information from data below Node 1, say ’98 : 100′, but only after identification of Node 1 and store it in an array say @value1 (i.e.values in @value1 correspond to data below Node 1). And similarly capture and store information from data below node 2, say 152 : 164, after node 2 has been identified in a different array say ‘@value2’. The regex I am using to capture information is
“qr/\s+([0-9]{2,3})\s[a-z]+\s(:)\s[a-z]\s([0-9]{3})/ “. But, if I use an ‘if’ statement

    while (<>){
     if ($_=~ /Node 1/){
     #capture information using regex
     }
    }   

before regex, script doesn’t return any value probably because it searches or regex in same line after word “Node”.

Any suggestions on how to jump to the next line after identification of particular node and capture information using regex.

  • 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-11T22:37:52+00:00Added an answer on May 11, 2026 at 10:37 pm

    Your question is a little confusing. You seem to want to use symbolic references, but you would be better off using a hash. See also “Why it’s stupid to use a variable as a variable name” parts 1, 2 and 3.

    #!/usr/bin/perl
    
    use strict;
    use warnings;
    
    my %data;
    
    my $current_node;
    
    while ( <DATA> ) {
        /^Node ([0-9]+):/ and $current_node = $1 and next;
        if ( /^\s+ ([0-9]+) \s debug \s : \s fill \s ([0-9]+)/x ) {
            push @{ $data{"value$current_node"} }, "$1 : $2";
        }
    }
    
    use Data::Dumper;
    print Dumper \%data;
    
    __DATA__
    
    Node 1:
    
            98 debug : fill 100
           102 debug : fill 104
    Node 2:
    
            88 debug : fill 120
           152 debug : fill 164
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 124k
  • Answers 124k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Are you running on OS 3.0? I saw the same… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer It looks like you need to register Apache::Session::Memcached with Apache::Session::Wrapper,… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer Use DATENAME or DATEPART: SELECT DATENAME(dw,GETDATE()) -- Friday SELECT DATEPART(dw,GETDATE())… May 12, 2026 at 1:19 am

Related Questions

I am working on an ASP.NET MVC application that contains a header and menu
I am working on a VB6 application that uses an ADODB.Recordset object to dump
I am somewhat new to Ruby and although I find it to be a
I am developing in python a file class that can read and write a
I am working on a Windows utility program which communicates with some custom hardware

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.