Use of uninitialized value in string eq ERROR

2006-01-15 Thread eyal edri
Hello,I keep getting this error and it drive me nuts. ('Use of uninitialized value in string eq' )i'll add a snippet from my code which produces this error:
use warnings;use File::Copy qw(copy);use Net::Domain qw(hostname hostfqdn hostdomain);use File::chmod;use Config::IniFiles;use File::Remove qw(remove);
my $missingPatch = no; foreach $patch (@patches) {  $showrev = `showrev -p | grep \Patch: $patch\`;  if ( length ($showrev) == 0 ) # meaning the patch isn't installed
  {   ...   if ( exists $installedPatch[1] ){ ($instPatchID, $instPatchVer) = split(/-/, $installedPatch[1]); }  if ( ( exists $patchName[1] )  ($patchName[1] lt $instPatchVer ) )
   {   }   else   {..  $missingPatch = yes;
   }  } }if ( $missingPatch =~ m/yes/ ) ---  this is where the error occurs. (i've tried also $missingPatch eq 1) or '1' or 1 ... .
 { .. } I can't understand why perl shouts about this, since this var has been initialized. (also tried removing use strict)thanks, Eyal Edri | System  Security Engineer| 
[EMAIL PROTECTED] Communication.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Use of uninitialized value in string eq ERROR

2006-01-15 Thread Chris Wagner
First fix ur line breaks!

At 10:02 AM 1/15/2006 +0200, eyal edri wrote:
}
if (  $missingPatch =~ m/yes/  )   ---  this is where the error occurs.
(i've  tried also $missingPatch eq 1) or '1' or 1 ... .
{ .. }

I can't understand why perl shouts about this, since this var has been
initialized.
(also tried removing use strict)

thanks,

Eyal Edri | System  


Put in a line to print the current value of $missingPatch just before this
stage so that u can see what Perl is going to compare.  Also, before the
print, check for definedness e.g. defined $missingPatch ? print
\$missingPatch is defined : print \$missingPatch is NOT defined;




--
REMEMBER THE WORLD TRADE CENTER ---= WTC 911 =--
...ne cede malis

0100

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Use of uninitialized value in string eq ERROR

2006-01-15 Thread Eric Amick
On Sun, 15 Jan 2006 12:05:08 -0800, you wrote:

my $missingPatch = no;
foreach $patch (@patches)
{
$showrev = `showrev -p | grep \Patch: $patch\`;
if ( length ($showrev) == 0 )  # meaning the patch isn't installed
{
  ...
if ( exists $installedPatch[1] )
{($instPatchID, $instPatchVer) = split(/-/,
$installedPatch[1]); }

if ( ( exists $patchName[1] )  ($patchName[1] lt $instPatchVer
) )
{
   
}
else
{
   ..
  $missingPatch = yes;
}
}
}
if (  $missingPatch =~ m/yes/  )   ---  this is where the error occurs.

Count your braces. The right brace immediately above this if statement
closes the scope of your my variable, so the $missingPatch in the if
is a different (and obviously uninitialized) variable.
-- 
Eric Amick
Columbia, MD
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Use of uninitialized value in string eq ERROR

2006-01-15 Thread Chris Wagner
At 04:58 PM 1/15/2006 -0500, Eric Amick wrote:
Count your braces. The right brace immediately above this if statement
closes the scope of your my variable, so the $missingPatch in the if
is a different (and obviously uninitialized) variable.


I cleaned up the code he posted and made it executable.  There is no brace
above his my statement so that variable cannot go out of scope.  I ran his
code and the $missingPatch variable ended up as yes.  So something else is
wrong somewhere where he didn't post the code.







--
REMEMBER THE WORLD TRADE CENTER ---= WTC 911 =--
...ne cede malis

0100

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs