Is there a perl routine that I can utilize that would do the following? I’m looking for a good example.
I want to be able to print out a list of days based on a range.
As a parameter I want to be able to do something like:
./myperlscript -r 20110630 20110731 (as an example where -r = range).
So basically, if I can put (2) dates in this format as inputs and print me those days.
20110630
20110701
20110702
...
..
This should get you started. You probably want to add some input validation (ie making sure that the elements of
@ARGVare formatted correctly and that the first represents a date smaller than the second, etc, etc…).ETA: In case it isn’t clear what’s going on, we create
$dateas aDateTimeobject, parsing the year, month, and day that were given in$first_date. Then, we keep printing out the year, month, and day without separators ($date->ymd('')) and increase$dateby one day until we’re at$last_date.