Hi Owen, 

My code is as follows : 

use strict;
use warnings;
use Time::Local;

$days1 = epoch_days('30-Jan-09');
$days2 = epoch_days('16-Feb-09');

$day = $days1 - $days2;

print "Difference: @{[$days1 - $days2]} days\n";

BEGIN {

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

  sub epoch_days {

    my @dmy = split /-/, shift;
    $dmy[1] = $month_num{lc $dmy[1]} || 0;
  return timelocal(0, 0, 0, @dmy) / (24 * 60 * 60);
  }
}

-Rajini 





 

>-----Original Message-----
>From: Owen [mailto:rc...@pcug.org.au] 
>Sent: Monday, February 23, 2009 10:08 AM
>To: S, Rajini (STSD)
>Cc: Rob Dixon; Perl Beginners
>Subject: RE: Query in Perl Programming
>
>>
>> Hi Rob,
>>
>>  When I included the below code in my script, I  am getting below 
>> errors.
>>
>> Use of uninitialized value in integer ge (>=) at 
>> /usr/local/lib/perl5/5.8.0/Time/Local.pm line 73.
>> Use of uninitialized value in integer lt (<) at 
>> /usr/local/lib/perl5/5.8.0/Time/Local.pm line 73.
>> Use of uninitialized value in integer ge (>=) at 
>> /usr/local/lib/perl5/5.8.0/Time/Local.pm line 73.
>> Use of uninitialized value in integer gt (>) at 
>> /usr/local/lib/perl5/5.8.0/Time/Local.pm line 77.
>>
>> Any idea, why I am getting above errors ?
>
>
>Yes
>
>Because you are not passing the integers required by your 
>module Time::Local
>
>You are doing something wrong with your parsing or date extraction.
>
>Do you have a sample code snippet reproduces those errors and 
>that you can post here ?
>
>
>
>
>Owen
>
>
>
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to