in reply to Newbie Q re: Undefined Value and "only used once" warnings

Another issue that the above posts touch on is your use of package variables. When you refer to $MAIN::Log, that is being treated as the variable called $Log in the package MAIN. This has nothing to do with your declaration MAIN:, which is merely creating a line label that you could use in a next or last statement. If you really want a package, you should declare it with package MAIN;. But I think a better idea, would be to put your decalarations like this:

my $Log; my $LogMsg; my $StdErr;

at the very top of your program outside any blocks. Then remove all the MAIN:: references everywhere you have them now.

Replies are listed 'Best First'.
Re: Re: Newbie Q re: Undefined Value and "only used once" warnings
by mikeatrcn (Acolyte) on May 15, 2004 at 20:28 UTC
    Thank you all!!!!!!!!!!

    These are all very valid points, well explained, and VERY much appreciated, as I learn Perl while developing an application under time constraints at work!