> -----Original Message-----
> From: Lance Prais [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 03, 2002 1:55 PM
> To: Perl
> Subject: Day Month Issues
> 
> 
> I am getting the following error when I execute my script. It is not
> erroring out nor is it not working as I think it should.  I 
> am just curious
> why this is happening.  Any Ideas?
> 
> Thanks
> Lance
> 
> CODE:
> 
>      
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
> 
> ERROR:
> 
> Name "main::mday" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\
> in\outlook.pl line 15.
> Name "main::sec" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\b
> n\outlook.pl line 15.
> Name "main::isdst" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl
> bin\outlook.pl line 15.
> Name "main::year" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\
> in\outlook.pl line 15.
> Name "main::mon" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\b
> n\outlook.pl line 15.
> Name "main::wday" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\
> in\outlook.pl line 15.
> Name "main::yday" used only once: possible typo at
> E:\sea621\siebsrvr\BIN\Perl\
> in\outlook.pl line 15.

They're warnings, not errors. The warning is that you've
used a variable like $mday, but not used it anywhere else
in your script, and Perl thinks you may be making a typo.

(It's good that you have -w turned on, but you also need
"use strict;")

Ways to get rid of the error:

1. Use "my" to declare the variables.

  my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);

2. Use undef in place of the variables you aren't using:

  (undef,$min,$hour,undef,undef,undef,undef,undef,undef)=localtime(time);

  or just (you can remove trailing unused elements):

  (undef,$min,$hour)=localtime(time);

3. or even better, use an array slice:

  ($min, $hour) = (localtime)[1,2];

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to