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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:38:04+00:00 2026-05-11T23:38:04+00:00

Sample Data: 603 Some garbage data not related to me, 55, 113 -> 1-ENST0000

  • 0

Sample Data:

603       Some garbage data not related to me, 55, 113 ->

1-ENST0000        This is sample data blh blah blah blahhhh
2-ENSBTAP0        This is also some other sample data
21-ENADT)$        DO NOT WANT TO READ THIS LINE. 
3-ENSGALP0        This is third sample data
node #4           This is 4th sample data
node #5           This is 5th sample data

This is also part of the input file but i dont wish to read this. 
Branch -> 05 13, 
      44, 1,1,4,1

17, 1150

637                   YYYYYY: 2 : %

EDIT: In the above data. The column width is fixed for the sections but there might be some sections I do not wish to read. above sample data has been edited to reflect that.

So in this input file I want to read contents of first section ‘1-ENST0000’ into an array and contents of ‘2-ENSBTAP0’ into a separate array and so on.

I am having trouble coming up with a regex that will define the pattern …first three lines have <someNumber>-ENS<someotherstuf> and then there can also be node #<some number here>

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

    OK, based on your later comment, this is a little different than the previous question. Also, I now realize that node #54 is a valid entry in the first column.

    Update: I now also realize you do not need the first column.

    Update: In general, you neither want to nor need to deal with character arrays in Perl.

    Update: Now that you clarified the what should and should not be skipped, here is a version that deals with that. Add patterns to taste in the if condition.

    #!/usr/bin/perl
    
    use strict;
    use warnings;
    
    my @data;
    
    while ( <DATA> ) {
        chomp;
    
        if ( /^[0-9]+-ENS.{5} +(.+)$/
                or /^node #[0-9]+ +(.+)$/
        ) {
            push @data, [ split //, $1 ];
        }
    }
    
    use Data::Dumper;
    print Dumper \@data;
    
    __DATA__
    603       Some garbage data not related to me, 55, 113 ->
    
    1-ENST0000        This is sample data blh blah blah blahhhh
    2-ENSBTAP0        This is also some other sample data
    21-ENADT)$        DO NOT WANT TO READ THIS LINE. 
    3-ENSGALP0        This is third sample data
    node #4           This is 4th sample data
    node #5           This is 5th sample data
    
    This is also part of the input file but i dont wish to read this. 
    Branch -> 05 13, 
          44, 1,1,4,1
    
    17, 1150
    
    637                   YYYYYY: 2 : %
    

    As for learning how to fish, I recommend you read everything related in perldoc perltoc.

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

Sidebar

Ask A Question

Stats

  • Questions 272k
  • Answers 272k
  • 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 You should not convert the bytes into characters, that is… May 13, 2026 at 1:58 pm
  • Editorial Team
    Editorial Team added an answer $p_id =~ /^\Q$key\E/; May 13, 2026 at 1:58 pm
  • Editorial Team
    Editorial Team added an answer From my experience the ~ trick only works in server… May 13, 2026 at 1:58 pm

Related Questions

I'm new to persevere, I did the helloWorld tutorial, very impressive btw but I'm
Sample data: !!Part|123456,ABCDEF,ABC132!! The comma delimited list can be any number of any combination
Sample data A B 1 Date Amount 2 Apr 1 $6,000 3 May 1
Some sample data: DECLARE @TARGET TABLE ( ID INT, value INT ) ; DECLARE

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.