Probably what you want is something like the following:
#!/usr/bin/perl
use strict;
use warnings;
use Date::Manip;
my $start_date_str = '080225';
my $end_date_str = '080304';
my $std_start_date_str = join( '-', substr($start_date_str, 0,2 ), sub
+str($start_date_str, 2) );
my $std_end_date_str = join( '-', substr($end_date_str, 0,2 ), sub
+str($end_date_str, 2) );
my $current_dt = ParseDate( $std_start_date_str);
my $end_dt = ParseDate( $std_end_date_str);
while( $current_dt le $end_dt) {
my $display_date_str = UnixDate( $current_dt, '%y%m%d' );
print "$display_date_str\n";
$current_dt = DateCalc( $current_dt, '+ 1 day');
}
Be warned about using a (non-standard, and as such potentially bad) yymmdd format.
If your curious, read a bit through
Date::Manip to see why dealing with datetime data is far from trivial in most all circumstances.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.