[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-beginners
Subject:    Re: Query in Perl Programming
From:       Rob Dixon <rob.dixon () gmx ! com>
Date:       2009-01-30 12:01:43
Message-ID: 4982EC27.5030200 () gmx ! com
[Download RAW message or body]

S, Rajini (STSD) wrote:
>  
> Hi Rob, 
> 
> When I set the date to 30-Jan-2009 and run the code given below, 
> 
> Eg : 
> 
> When dates are set as : 
> 
> my $days1 = epoch_days('30-Jan-09');
> my $days2 = epoch_days('29-Feb-2009');
> 
> I get the below error. 
> 
> hpcll402:/home/ssssraji/perl>./date2.pl
> Day '30' out of range 1..28 at ./date2.pl line 35

My apologies - there is a problem with my code. The initialisation should be

  my %month_num = do {
    my $n = 0;
    map(($_, $n++), qw/jan feb mar apr may jun jul aug sep oct nov dec/);
  };

(The only change being that $n starts at zero instead of one.)

HTH,

Rob

-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic