By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,619 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,619 IT Pros & Developers. It's quick & easy.

Error : Use of uninitialized value in string at perl25.plx

P: 34
Hi All,

I have the following code.

The array @sub_data will contain integers or a string"NO". I have to validate if the array contain integer. If it contain "NO" then no need to validate.

for ($i=1;$i<10;$i++)
{
Tie::CheckVariables->on_error(sub{print "ERROR!"});
tie my $data,'Tie::CheckVariables','integer';
$data = $sub_data[$i];

if ("$data" ne "NO") {

if (($data < $firstVar) || ($data > $secVar))
{
#print " the subscriber $subph dosnot have valid data field $sub_fld .\n";
$erracur = 1;
}

} else {
print "NO";
}
}


I am getting following error.

Use of uninitialized value in string at perl25.plx line 269.
Use of uninitialized value in numeric lt (<) at perl25.plx line 273.
Use of uninitialized value in string at perl25.plx line 269.
Use of uninitialized value in numeric lt (<) at perl25.plx line 273.
ERROR!ERROR!



If any thing wrong please let me Know.


Regards
Naveen
Apr 26 '07 #1
Share this Question
Share on Google+
2 Replies


KevinADC
Expert 2.5K+
P: 4,059
those are warnings, not errors. The problem is probably in here:

Expand|Select|Wrap|Line Numbers
  1. $data = $sub_data[$i];
  2.  
  3. if ("$data" ne "NO") {
  4.  
  5. if (($data < $firstVar) || ($data > $secVar))

$data must not be getting defined which means $sub_data[$i] must not be defined. Print $data to the screen as the script runs to check its value. Did you get Tie::CheckVariables working?
Apr 26 '07 #2

P: 34
those are warnings, not errors. The problem is probably in here:

Expand|Select|Wrap|Line Numbers
  1. $data = $sub_data[$i];
  2.  
  3. if ("$data" ne "NO") {
  4.  
  5. if (($data < $firstVar) || ($data > $secVar))

$data must not be getting defined which means $sub_data[$i] must not be defined. Print $data to the screen as the script runs to check its value. Did you get Tie::CheckVariables working?

Hi kevin,

I got working Tie::CheckVariables .

The array @sub_data have to empty fields.So I got that warning message.

Now i solved It.
Thanks for your help.

Regards
Naveen
Apr 27 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.