Hi Nikola/Jason
Thanks for the help.
The variable $result_value1 is declared within the subroutine and is never
used outside the subroutine.
I originally had the following piece of code (which I forgot to show you
guys in the previous email):

$result_value1 = $database1{$input_key1}

But I changed the above code to the following and it worked ("Use of
uninitialized value" error message" did not appear):

$result_value1 = $database1{$input_key1} || " "; 
if ($result_value1 ne " ") {
         $a= substr($result_value1, 0, 8);
         $b= substr($result_value1, 8, 2);
         $c= substr($result_value1, 10, 2);
         return ($a, $b, $c);
}
else {
         return (" ", " ", " ");
}

Cheers
Tony

-----Original Message-----
From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
Sent: 13 March 2002 17:16
To: 'Jason Larson'; 'Ho, Tony'; '[EMAIL PROTECTED]'
Subject: RE: "Use of uninitialized value" error message


that actually won't get rid of the warning. but you are right the
declaration at the top of the script of the varible goes out of scope when
it reaches the if.

you are using -w or 
use warnings; in your script that is causing the warning.

perhaps attaching the code would help but we can't tell where the varible
goes out of scope.



-----Original Message-----
From: Jason Larson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 13, 2002 11:06 AM
To: 'Ho, Tony'; '[EMAIL PROTECTED]'
Subject: RE: "Use of uninitialized value" error message


> -----Original Message-----
> From: Ho, Tony [mailto:[EMAIL PROTECTED]]
> Subject: "Use of uninitialized value" error message
> 
> Hi guys
> I was wondering if you could help me with the following problem.
>  
> I am getting the following error message:
>  
> Use of uninitialized value in string ne at 
> format_imsi_msisdn.pl line 257.
> 
> line 257 and beyond consist of the following:
>  
> if ($result_value1 ne " ") {
>           $a= substr($result_value1, 0, 8);
>           $b= substr($result_value1, 8, 2);
>           $c= substr($result_value1, 10, 2);
>           return ($a, $b, $c);
> }
> else {
>           return (" ", " ", " ");
> }
>  
> I declare the variable result_value1 at the begining of the method as
> follows
>  
> my $result_value1 =" ";
>  
> Any ideas why ?

I'm still new to Perl myself, so I can't tell you exactly what's happening,
but it looks like $result_value1 is undef when it gets to the if statement.
I think a better way to accomplish what you're trying to do is simply:

  my $result_value1;
  if ($result_value) { #$result_value1 is defined
     $a= substr($result_value1, 0, 8);
     $b= substr($result_value1, 8, 2);
     $c= substr($result_value1, 10, 2);
  } else { #$result_value1 is still undef
     return (" ", " ", " ");
  }

Hope this helps...
Jason


CONFIDENTIALITY NOTICE:

************************************************************************

The information contained in this ELECTRONIC MAIL transmission
is confidential.  It may also be privileged work product or proprietary
information. This information is intended for the exclusive use of the
addressee(s).  If you are not the intended recipient, you are hereby
notified that any use, disclosure, dissemination, distribution [other
than to the addressee(s)], copying or taking of any action because
of this information is strictly prohibited.

************************************************************************

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.

Reply via email to