use Date::Calc qw(Delta_Days); @bree = (1981, 6, 16); # 16 Jun 1981 @nat = (1973, 1, 18); # 18 Jan 1973 $difference = Delta_Days(@nat, @bree); print "There were $difference days between Nat and Bree\n"; There were 3071 days between Nat and Bree
-----Original Message----- From: Angerstein [mailto:[EMAIL PROTECTED] Sent: 10 September 2007 14:33 To: 'Mathew Snyder'; 'Perl Beginners' Subject: AW: User input: dates spanning multiple months First I would use unix internal time format(epochen). And I would use Date-Calc (search.cpan.org/dist/Date-Calc/), Date-Calendar. This should solve nearly all of your problems. Parsing CLI, should be done with getopt... BTW: Ever heard about cron? -----Ursprüngliche Nachricht----- Von: Mathew Snyder [mailto:[EMAIL PROTECTED] Gesendet: Montag, 10. September 2007 13:18 An: Perl Beginners Betreff: User input: dates spanning multiple months I have a script which has to be manually edited to run for a span of days. When these days are over several weeks it can be clearly tedious to enter dates in yyyy-mm-dd format. I've decided to set it up to ask for user input. What I need is some input on is how to make it create the array for all the dates requested. For instance, if someone wants to run the script spanning 07/20/2007 to 08/20/2007 how can I split that up to ensure it runs across all days and both months? I'm thinking I would have to split each argument into an array and then create an array for the months and days running a foreach loop over them both. But then, how would I accommodate the varying number of days in each month? Any input will be appreciated. Thanks. Mathew -- Keep up with me and what I'm up to: http://theillien.blogspot.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ This e-mail is from the PA Group. For more information, see www.thepagroup.com. This e-mail may contain confidential information. Only the addressee is permitted to read, copy, distribute or otherwise use this email or any attachments. If you have received it in error, please contact the sender immediately. Any opinion expressed in this e-mail is personal to the sender and may not reflect the opinion of the PA Group. Any e-mail reply to this address may be subject to interception or monitoring for operational reasons or for lawful business practices. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/