Yeah, the script posted below is part of the code In my script. After including the below code, when I ran the script, I am getting the "uninitialized value" errors.
-Rajini >-----Original Message----- >From: Owen [mailto:rc...@pcug.org.au] >Sent: Monday, February 23, 2009 12:03 PM >To: S, Rajini (STSD) >Cc: Perl Beginners >Subject: RE: Query in Perl Programming > >> >> #perl -c <script name> >> >> syntax OK > > > >Nope, > >I bet you ran that against the script you have on your >computer and NOT the script you posted below. > >Fix that and I will tell you how to the fix the rest > > >Owen > > >> >> >>>-----Original Message----- >>>From: Owen [mailto:rc...@pcug.org.au] >>>Sent: Monday, February 23, 2009 11:09 AM >>>To: S, Rajini (STSD) >>>Cc: Perl Beginners >>>Subject: RE: Query in Perl Programming >>> >>>> >>>> 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); >>>> } >>>> } >>> >>> >>> >>>I bet that is not your code! >>> >>>Try # perl -c scriptname >>> >>>and that will be the first fix >>> >>> >>>Owen >>> >>> >> -- >> To unsubscribe, e-mail: beginners-unsubscr...@perl.org For >additional >> commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ >> >> >> > > > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/