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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:14:12+00:00 2026-05-31T02:14:12+00:00

How to use pointer concepts in Perl? For example I have a line and

  • 0

How to use pointer concepts in Perl? For example I have a line and want to search for the given string any where in the that line by positioning using the pointer. Kindly suggest me.

So I have 2 files with a key it like in 1st file I have data as in following columns with value in it as…

ID|Rating_Provider|Time|QualityRating z6Y1kWFT99|S&P_LONG|20110120 12:00:00 AM|NR z6Y1kWFT99|MOODY'S_LONG|20101101 12:00:00 AM|NR 

and in 2nd file I have data as in following columns in it as…

ID|BBCMPSEC|QualityRating_S&P_LONG|Time_S&P_LONG|QualityRating_MOODY'S_LONG|Time_‌​MOODY'S_LONG 

Now finally I need to see the data as…

ID|BBCMPSEC|QualityRating_S&P_LONG|Time_S&P_LONG|QualityRating_MOODY'S_LONG‌​|Time_MOODY'S_LONG z6Y1kWFT99|xxx|NR|20110120 12:00:00 AM.
  • 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-31T02:14:13+00:00Added an answer on May 31, 2026 at 2:14 am

    ETA: Based on your comments, I would say that you’d be best off using Text::CSV. Take a look at the documentation, it is quite helpful. Basically, you would do something like:

    use Text::CSV;
    my $csv = Text::CSV->new({
        binary     => 1,
        sep_char   => "|",
    });
    open my $fh, "<", "inputfile" or die $!;
    
    while (my $row = $csv->getline($fh)) {
        # @$row now contains your row data
    }
    

    Old answer

    “pointers” are not used in perl. I assume you mean the position of the match. There are several ways. You can use index if you do not need any regexes:

    perl -lwe 'print index("foobar", "bar");'
    

    If you do need a regex, perhaps for some more complicated matches, you can use the predefined variable @-, which stores the position where your match begins:

    perl -lwe '$str = "foobar"; if ($str =~ /bar/) { print $-[0] }'
    

    However, I suggest you tell us what it is you are trying to do. Using string offsets is not the best perl tool in the box, and I suspect there are much better ways of solving your problem.

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

Sidebar

Related Questions

I have to use a smart pointer and I found shared_ptr from boost looks
I have a program that I need to use signals and handlers with. I
i use pointer for holding name and research lab property. But when i print
What is a smart pointer and when should I use one?
I'm trying to use RAII concepts with an STL container of ofstream objects. For
In a project I'm writing code for, I have a void pointer, implementation, which
I have the following SQL statement: USE ws_results_db_2011_09_11_09_06_24;SELECT table_name FROM INFORMATION_SCHEMA.Tables WHERE table_name like
I have to write a program for my C programming class that takes a
This is my first time using stackoverflow for a question, I have read a
I am writing some Python code to implement some of the concepts 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.