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

  • Home
  • SEARCH
  • 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 6120573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:41:01+00:00 2026-05-23T15:41:01+00:00

What is the optimal/clearest way to loop between two dates in Perl? There are

  • 0

What is the optimal/clearest way to loop between two dates in Perl? There are plenty of modules on CPAN that deal with such matter, but is there any rule of thumb for iterating between two dates?

  • 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-23T15:41:01+00:00Added an answer on May 23, 2026 at 3:41 pm

    For everything that uses Date manipulation DateTime is probably the best module out there. To get all dates between two dates with your own increment use something like this:

    #!/usr/bin/env perl
    use strict;
    use warnings;
    use DateTime;
    
    my $start = DateTime->new(
        day   => 1,
        month => 1,
        year  => 2000,
    );
    
    my $stop = DateTime->new(
        day   => 10,
        month => 1,
        year  => 2000,
    );
    
    
    while ( $start->add(days => 1) < $stop ) {
        printf "Date: %s\n", $start->ymd('-');
    }
    

    This will output:

    Date: 2000-01-02
    Date: 2000-01-03
    Date: 2000-01-04
    Date: 2000-01-05
    Date: 2000-01-06
    Date: 2000-01-07
    Date: 2000-01-08
    Date: 2000-01-09
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was told that the optimal way to program in C++ is to use
I'm looking for the optimal way to create a function that can accept no
Is there a more optimal way to obtain subtrings which are separated by ','
We are working an algorithm that calculate the optimal way to move resources from
How can I do that in a optimal way? TABLE ID FLAG VALUE ----------------------------
What is the most optimal way (algorithm) to search for the word that has
What would be the optimal way to develop a basic graphical application for Windows
I am trying to find an optimal solution for the following problem: there is
I have been thinking about the optimal way to create an XML file using
Has anyone else found VIM's syntax highlighting of Javascript sub-optimal? I'm finding that sometimes

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.