"Use of uninitialized value" error message

------_=_NextPart_001_01C1CAA2.30DFA380
Content-Type: text/plain;
	charset="iso-8859-1"

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 ?
 
Thanks in advance
Tony
 
 

------_=_NextPart_001_01C1CAA2.30DFA380--
0
Tony_Ho
3/13/2002 3:17:29 PM
perl.beginners 29368 articles. 3 followers. Follow

6 Replies
456 Views

Similar Articles

[PageSpeed] 5

------_=_NextPart_001_01C1CAA8.FD04E140
Content-Type: text/plain;
	charset="iso-8859-1"

> -----Original Message-----
> From: Ho, Tony [mailto:Tony_Ho@csgsystems.com]
> 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.

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

------_=_NextPart_001_01C1CAA8.FD04E140--
0
jasonl
3/13/2002 4:06:09 PM
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:jasonl@swbanktx.com]
Sent: Wednesday, March 13, 2002 11:06 AM
To: 'Ho, Tony'; 'beginners@perl.org'
Subject: RE: "Use of uninitialized value" error message


> -----Original Message-----
> From: Ho, Tony [mailto:Tony_Ho@csgsystems.com]
> 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.

0
nikola_janceski
3/13/2002 4:16:19 PM
------_=_NextPart_001_01C1CAAB.E90F58C0
Content-Type: text/plain;
	charset="iso-8859-1"

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:nikola_janceski@summithq.com]
Sent: 13 March 2002 17:16
To: 'Jason Larson'; 'Ho, Tony'; 'beginners@perl.org'
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:jasonl@swbanktx.com]
Sent: Wednesday, March 13, 2002 11:06 AM
To: 'Ho, Tony'; 'beginners@perl.org'
Subject: RE: "Use of uninitialized value" error message


> -----Original Message-----
> From: Ho, Tony [mailto:Tony_Ho@csgsystems.com]
> 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.

------_=_NextPart_001_01C1CAAB.E90F58C0--
0
Tony_Ho
3/13/2002 4:27:04 PM
------_=_NextPart_001_01C1CAAE.8F02C8D8
Content-Type: text/plain;
	charset="iso-8859-1"

  ----Original Message-----
From: Ho, Tony [mailto:Tony_Ho@csgsystems.com]
Subject: RE: "Use of uninitialized value" error message

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} || " ";  
 
------------------------------------
ahh... that would do it, though I don't think that's the preferred way to
solve your problem.
 
You are getting the "Use of uninitialized value" warning message because
$database1{$input_key1} is undef.  You are simply bypassing that by making
$result_value1 a " " if it would otherwise return undef.  By using your
original code ( $result_value1 = $database1{$input_key1}; ) with "if
($result_value1);" you do what you want and avoid the warning because you
are now checking to see if $result_value1 is defined.  I know that Nikola
says you will still get the warning, but it always works for me...  :)
 
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.

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

------_=_NextPart_001_01C1CAAE.8F02C8D8--
0
jasonl
3/13/2002 4:46:01 PM
Jason Larson wrote:
> 
> 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
    ^^^^^^^^^^^^^^^^^^                      ^^^^^^^
This is _NOT_ testing whether $result_value1 is defined or not (in fact
it is not testing $result_value1 at all :-), it is testing whether
$result_value1 is true or false which is not the same thing.

   if ( defined $result_value1 ) { #$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 (" ", " ", " ");
>   }



John
-- 
use Perl;
program
fulfillment
0
krahnj
3/13/2002 10:51:13 PM
------_=_NextPart_001_01C1CB62.620BA051
Content-Type: text/plain;
	charset="iso-8859-1"

> -----Original Message-----
> From: John W. Krahn [mailto:krahnj@acm.org]
> Subject: Re: "Use of uninitialized value" error message
> 
> Jason Larson wrote:
> > 
> > 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
>     ^^^^^^^^^^^^^^^^^^                      ^^^^^^^
> This is _NOT_ testing whether $result_value1 is defined or 
> not (in fact
> it is not testing $result_value1 at all :-), it is testing whether
> $result_value1 is true or false which is not the same thing.
> 
>    if ( defined $result_value1 ) { #$result_value1 is defined
> 
Doh!  My bad...  You are, of course, correct.  Thanks for pointing out my
error.
(for any beginners reading this that may not understand the difference, let
me give a quick example...)
 use warnings;
 use strict;
 my $result_value = "0";
 if ($result_value) {
   print "\$result_value is defined and is: $result_value";
 } else {
   print "\$result_value is undefined"
 }
 __END__

This prints out "$result_value is undefined", which is obviously not true.
If we change the if statement as John pointed out, we get a better result

 if (defined $result_value) {

This prints out "$result_value is defined and is: 0", which is a better
evaluation of the variable.

Sorry about the confusion, and I 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.

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

------_=_NextPart_001_01C1CB62.620BA051--
0
jasonl
3/14/2002 2:13:15 PM
Reply:

Similar Artilces:

"Use of uninitialized value" when clicking on "login again" link
We migrated a Bugzilla 2.20 installation from one server to another. Everything seems to work just fine, except when clicking on the "log in again" link after a logout. We get a "index.cgi: Use of uninitialized value in substitution (s///) at (eval 22) line 44" error message at the top of the page, but can re-log without any issues. When we click on the "Actions => Home" link instead of the propose "log in again" one, we do not get this error message and can re-log too. Any idea of what could happen (bad permission, and so on?). -- V...

checksetup.pl "Use of uninitialized value" errors
I'm installing bugzilla (2.19) under RedHat 9. Attempts to run checksetup.pl (using Perl 5.8.0) result in a slew of messages of the form: checksetup.pl: Use of uninitialized value in chown at checksetup.pl line 1079. [Wed Aug 4 17:02:26 2004] checksetup.pl: Use of uninitialized value in chown at checksetup.pl line 1079. Use of uninitialized value in chown at checksetup.pl line 1090 (#1) [Wed Aug 4 17:02:26 2004] checksetup.pl: Use of uninitialized value in chown at checksetup.pl line 1090. [Wed Aug 4 17:02:26 2004] checksetup.pl: Use of uninitialized value in chown at check...

Lot of error in error logs for "Use of uninitialized value in exists at Bugzilla/DB/Schema.pm line 1781"
Hi, I get a lot of bugs of this type "Use of uninitialized value in exist= s at Bugzilla/DB/Schema.pm line 1781" in my apache error log. I am running bugzilla version 3.6 and have not upgraded to any versio= n after this. Thanks Subodh Konhor ...

"option value out of range" error message when using .net
I have an app which reads/writes to a sybase 7.0.4 database. When compiled using visual C++ v6 it works fine. When I compile under .net, any write to the database causes a "option value out of range" exception to be thrown when the recordset is updated. This happens for any write - even if it's to a simple table of 1 column, regardless of data type. I can't find any documentation about this error message. Any idea about what it means, or how to fix it? Running the server adding '-zr SQL' will at least show you what SQL operation and data values are being ...

Bugzilla 3.0.3
Today, I was trying to reset a users password in Bugzilla and I received this warning: editusers.cgi: Use of uninitialized value in string ne at Bugzilla/Object.pm line 176. It seems that the update took but just curious if anyone knows what this is realted to. The error seems to point to the following line: edit_processing($match_user); In this section of code: if ($matchtype eq 'exact' && scalar(@{$vars->{'users'}}) == 1) { my $match_user_id = $vars->{'users'}[0]->{'userid'}; my $match_user = check_...

Mail pseudo-error
In a brand new XP system with Netscape 7.1, sending mail (not news) results in the "delivering mail" window, followed soon after by a window headed "Send Message Error" with text "Sending of Message Failed" followed by an indication that the SMTP server refused to handle it. BUT THE MESSAGE *IS* sent successfully! The "delivering message" window ends up saying "Mail sent successfully", with the progress bar still moving because the error message is still there. Closing the error message window closes the "delivering" w...

"Using" or "With"
Hi all Please can someone enlighten to me as regards the difference with the "Using" and "With" statement when accessing data - which is better, what are the limitations and/or any pointers. Many thanks. Regards DaveDavid WinchesterPlease mark as answer if this is the solution.  using gives you the ability to use the connection and it closes the connection directlly after you finish using it. and there is no need to try- cach - finaly. there is no limitation on using USING keywordMuhanad YOUNISMCSD.NETMy Blog || My Photos || LinkedIn I have a dataobject the re...

Using "+" or "||"
Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||" in ISQL to indicate a string concatenation. I needed to paste my SQL statement into the PowerBuilder script painter for some embedded SQL, and PB didn't like the "||" very much at all. I changed it to "+" and it seems to be ok. Do these two operators indicate ~exactly~ the same thing? moin, afaik these two's are not the same! if you're using "||" and any term is NULL then in the resultstring the term will be ignored if you use "+" then the resu...

error message "Use of uninitialized value in concatenation (.) or string at
hi, please help me ... I have a perl script as follows: #! / Usr / bin / perl-w # Use module use strict; use DBI; # The variable declaration my $ dbh_lina; my $ dbh_sales; my $ sql_psb; my $ ext_psb; my $ total_row; my $ rs_data; my $ sql_rep; my $ ext_rep; # Connect to DB # $ Dbh_csdm = DBI-> connect ("DBI: mysql: csdm2: 10.1.96.200", "csdm2", "csdm2123", {RaiseError => 0, PrintError => 0}) or die "Could not connect to database : ". DBI-> errstr; $ Dbh_lina = DBI-> connect ("...

Single Quote Error While writing RegisterClientScriptBlock("key", "Value")
Hi Friends, I am facing one problem due to single quote. I am writing underwritten script to close currently opened form and to get those values in another form. ############################################################# strScript as string strscript = " <script> window.opener.document.Form1.txtAddressLocationh2.value='Factory'; window.close(); </script> " Me.RegisterClientScriptBlock("key", strScript) ############################################################# Now if i have value of "Facto'ry" instead o...

"Sent" instead of "Drafts" in error message
I was just composing a message when Internet connection was lost. An error message complained that the message could not be copied to the Sent folder. After some trying, I understood that obviously the Drafts folder was meant. I'm using latest-comm-1.9.1 ... Is there a bug on this yet? I think this should be fixed for release. We're already string-frozen for the next beta, right? :-| Jens M�ller wrote: > I was just composing a message when Internet connection was lost. An > error message complained that the message could not be copied to the > Sent folder. After s...

Error: while using "MD5" and "SHA1" algorithms.
Hi, when i tries to insert password other than "ratnesh" and "iaza1234" the error is generated. "incorrect syntax 'i58g9e6c6s31de5s1e2d' "private void butInsert_Click(object sender, System.EventArgs e) {SqlConnection myConn = new SqlConnection("workstation id=JASIM;packet size=4096;user id=ASPNET;data source=JASIM;persist security info=False;initial catalog=Test");  string Encrypt_MD5 = FormsAuthentication.HashPasswordForStoringInConfigFile(txtpassword.Text,"MD5"); SqlCommand InCommand = new SqlCommand("CreateUser ...

Keep getting "Use of uninitialized value in pattern match (m//) at Bugzilla/Util.pm line 58" error
Hi, Does any one know if there is fix for this. I get this for [Sat Apr 3 10:19:20 2004] editkeywords.cgi: Use of uninitialized value in pattern match (m//) at Bugzilla/Util.pm line 58. Thanks, -shahriar ...

Use Loadcontrol and receive "Could not load type error" Error message
hi,I have a vb.net asp.net web app.suddenly after working for long time, I get this error message in my app:Could not load typewhen trying to show a web form.what can be the error?the iis app is still there.the DLL checked in reflector and have the type inside it declared as public.security to the file is OK (even in filemon I can see that aspnet_wp.exe isaccessing the file)what can be the problem? I just don't know what to do!additional information:the page is an aspx web for without code behind that is inheriting from aPageBase that is declared in my APP.the pageBase type is loaded fine, a...

Web resources about - "Use of uninitialized value" error message - perl.beginners

Warnings, /sdl, and improving uninitialized variable detection
... developers prioritize which instances were the most likely to have security implications. The C4701 warning identifies potential usage of uninitialized ...

Uninitialized on Steam
Featured News Recommended Wishlist STATS "> STORE Home DISCUSSIONS Workshop Greenlight Market "> Community ABOUT SUPPORT Install Steam login ...

C Sharp (programming language) - Wikipedia, the free encyclopedia
(pronounced see sharp ) is a multi-paradigm programming language encompassing strong typing , imperative , declarative , functional , generic ...

Microsoft XML vulnerability under active exploitation
... a Security Advisory describing a vulnerability in the Microsoft XML component. We discovered this vulnerability—which is leveraged via an uninitialized ...

Windows driveby attack on aeronautical website may be state sponsored
... exploit was planted on the site by "cybercriminals" who first managed to compromise its security. The vulnerability, which stems from an uninitialized ...

McAfee Labs - Blog Central
#McAfeeFOCUS , #MFETrivia , #SecChat , #SecurityLegos , $1 million guarantee , .pre , 3DS , 3G , 12 Scams of Christmas , 99 things , 419 scam ...

Product Reviews - Make-Up - Women's Business Network and Lifestyle Magazine - DestinyConnect
23 June 2012 REGISTER - HELP - DESTINYMAN.COM - LEGAL - CONTACT US facebook twitter linkedin rss Editorial Social Search: DESTINY LOGO Home Business ...

Issues - chromium - An open-source browser project to help move the web forward. - Google Project Hosting ...
My favorites ▼ - Sign in chromium An open-source browser project to help move the web forward. Project Home Downloads Wiki Issues New issue Search ...

pcs hacks - Hack a Day
Pinball Stomp: Part 2 posted May 7th 2012 3:35pm by Caleb Kraft filed under: classic hacks , pcs hacks , peripherals hacks This is the 2nd and ...

Is String.IsNullOrEmpty Good or Bad?
I started to wonder about that when I was looking for an equivalent method in Ruby. Apparently, Ruby doesn’t come with such a method built-in, ...

Resources last updated: 12/16/2015 7:40:44 AM