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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:06:56+00:00 2026-05-30T16:06:56+00:00

So I have an ID range for pages in a document that I need

  • 0

So I have an ID range for pages in a document that I need to loop to compare values. My problem is the ID’s are strings and not number so when I try and loop the range with Perl it doesn’t work. Here is an example of my range loop, and an example of my data.

foreach($begID..$endID){
   print $_;
}

A data example would be

 $begID = ABC-ABC-00001; 
 $endID = ABC-ABC-00100;

My problem is I cannot loop these values. I know I could split the data based on the “-” and get the 00001 and 00100 values, but the problem with that is the data can vary on different files I am working with.

Is there any other way that someone could suggest to go about this?

UPDATE

Until I can post my own answer (in another 7 hours due to being under 100 rep) here is what I came up with:

Okay here is what I did as a solution. I can regex out the numbers starting from the end until it hits an alpha character.

($start) = $begID =~ m/(\d+)$/;
($end) = $endID =~ m/(\d+)$/;

Then create the loop from there.

  • 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-30T16:06:57+00:00Added an answer on May 30, 2026 at 4:06 pm

    “data can vary” how?

    If by having a fixed string prefix + the number, you can split off the prefix:

    my ($prefix, $start) = ($begID =~ /^(\D+)(\d+)$/;
    my ($prefix2, $end) = ($endID =~ /^(\D+)(\d+)$/;
    die "Prefixes don't match" unless prefix eq $prefix2;
    foreach my $index ($start .. $end) {
        my $id = "prefix$index";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have range from E2 to E16. How do I read values from
I have a range of data that I have approximated using a polynomial of
I have a Range variable that contains an address - $2:$2,$4:$205,$214:$214 - (3 groups
I have create name range on sheet A so I need to use this
I have a form that takes date range value to generate a report with
If i have 1000 pages of html can i provide option for page range
I have two pages that use the flot jquery plugin, and they both work
I have a C# collection of strings. Each string is a sentence that can
i have a website where certain pages have a facebook share button. I need
serializeArray() does not pick up form fields that have been added after page load

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.