Rishi Kabra wrote:
> 
> Hi ,
> I have written a PERL script which asks user to key in date and then it
> does some calculations in that date and stores it in different
> variables.
> The objective of the script is to make changes at certain places in a
> UNIX file whenever you run this file.Basically it replaces the existing
> dates in the UNIX file and substitute it with the new calculated dates.
> 
> Now the problem is how do i input the dates from the user?
> Because right now i have just defined a simple variable $input to get
> the dates.
> so if user keys in 20010731 and if i add 7 to it it becomes 20010738
> instead of going into the month of August.
> Is there a way to define a date variable in PERL.I am a beginner in PERL
> so dont know how to do it.
>  Can somebody please help me out?
> Thanks
> Rishi Kabra

There are several modules on the CPAN (Comprehensive Perl Archive
Network)
to help you deal with dates (and times). Two of them are Date::Calc and
Date::Manip. You can look at their documentation on search.cpan.org at
these locations.

http://search.cpan.org/doc/STBEY/Date-Calc-4.3/Calc.pm
http://search.cpan.org/doc/SBECK/DateManip-5.40/Manip.pod

http://search.cpan.org/search?mode=module&query=Date will show you many
more.

If you are beginner in perl, then you are better off wandering to the
perl-beginners list (http://lists.perl.org/showlist.cgi?name=beginners).
This list is geared towards module development and related issues.

HTH,
/prakash

Reply via email to