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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:14:09+00:00 2026-06-04T09:14:09+00:00

I have a SD file to read. I couldn’t upload the whole file. so

  • 0

I have a SD file to read. I couldn’t upload the whole file. so I gave a snapshot in the image below.

A SD file (Structural data file) that explains the structure of a molecule. 803 and AMH are two molecules. Also, within same molecule there are several fragments. Each fragment is separated by four dollar sign ($$$$).
This is a SD file (Structural data file) that explains the structure of a molecule. 803 and AMH are two molecules. Also, within same molecule there are several fragments. Each fragment is separated by four dollar sign ($$$$). I am a new to perl as I am a biomedical research student. However, I wrote a script that finds the occurrence of $$$$ and then the occurrence of molecule code (here 803) in line next to it.

{
    open (FILE, '<', "try_803.txt");    
    my $ligandcode="803";    
    while (<FILE>) {
        my $nextline = <FILE>;     
        if ( $_=~/\x24\x24\x24\x24/ &&  $nextline=~/$ligandcode/){    
            # do something
        }    
    }    
} 

This code checks the very first occurrence of $$$$ followed by 803. But, I want it to go further to next occurrence of $$$$ followed by 803. I don’t know how many times will this pattern will occur. technically I can’t specify the no of fragment before hand. Can you help me improving this code and finding a solution for problem. I’ll be grateful.

  • 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-04T09:14:11+00:00Added an answer on June 4, 2026 at 9:14 am

    You can set the input record separator to four dolar signs, a newline and 803.

    local $/ = '$$$$' . "\n803";
    

    Then, you can read the whole molecules in a loop:

    while (<FILE>) {
        my $molecule = $_;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a config file that I read using the RawConfigParser in the standard
I have this file which I need to read the first bytes to check
I have one binary file and I want to read this file like first
I have a text file. I want read that file. But In that if
I have a .txt file having some text. I want to read this file
When I using the following code to read file: lines=file(data.txt).read().split(\n) I have the following
Say that I have the Python code: someString = file(filename.jpg).read() How can I replicate
I have this Perl/CGI to upload files and get the uploaded file size while
I'm trying to read from a file some data I already have and to
I read this and this . But i couldn't find the answer. I have

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.