in reply to use of uninitialized variables??
Dear Monks, I am calling a subroutine in my perl programme, the subroutine is:
While running the programme it gives me the following warnings (although the results are as expected...)the line numbers I refer here are as perl the line no of the subroutinecode with the first line as from where sub starts ..sub Get_Calibrator_Filename{ my(@complex,$temp,$calib1,@val1,@val2,$tempx,$tempy,@tempxy,@val3,$cal +ib2,$comparison,$val4,$val); #local($tempxy[0],$val2[0],$val1[0],$val3[0]); @complex=("1a","2b","3c","4d","5e","6f","7g","8h","9i","10j","11k","12 +l","13m","14n","15o","16p","17q","18r","19s","20t","21u","22v","23w", +"24x"); $calib1=$_[0]; $comparison=$_[1]; for ($temp=0;$temp<=3;$temp++) { chop($calib1); } $tempx=chop($calib1); $tempy=chop($calib1); @val1=grep(/\d{1,2}$tempx/,@complex); @val2=grep(/\d{1,2}$tempy/,@complex); @val3=grep(/\d{1,2}$comparison/,@complex); chop($val1[0]);chop($val2[0]);chop($val3[0]); if ($val1[0] <$val3[0]) { $val4=$val1[0]+24-$val3[0]; } else { if($val1[0]>$val3[0]) { $val4=$val1[0]-$val3[0]; } } if ($val2[0] > $val4) { $val=$val2[0]-$val4; @tempxy=grep(/$val\S/,@complex); $tempxy[0]=chop($tempxy[0]); $tempxy[0]=$tempxy[0].$comparison; $calib2=$calib1.$tempxy[0]."1.1d"; } else { print "VAL1=",$val1[0]," VAL2=",$val2[0],"VAL3=",$val3[0],"\n"; if ($val1[0]<$val3[0]) { $val4=$val3[0]-$val1[0]; } else { if($val1[0]>$val3[0]) { $val4=24-$val1[0]+$val3[0]; } } $val=$val2[0]+$val4; @tempxy=grep(/$val\S/,@complex); $tempxy[0]=chop($tempxy[0]); $tempxy[0]=$tempxy[0].$comparison; $calib2=$calib1.$tempxy[0]."1.1d"; } print "\n filegot=$_[0] \n fileout=$calib2\n"; return ($calib2); }
It doen't helps even if I include in my($val10,$val20.etc...) Thanks, V.N.PandeyUse of uninitialized value at checkdataperl.pnew1 line 16, <STDIN> chu +nk 1162. Use of uninitialized value at checkdataperl.pnew1 line 29, <STDIN> chu +nk 1162. Use of uninitialized value at checkdataperl.pnew1 line 39, <STDIN> chu +nk 1162. Use of uninitialized value at checkdataperl.pnew1 line 51, <STDIN> chu +nk 1162.
This is c-era: I ran the program with strict and -w and recieved no errors. You may want to try setting all of your variables to 0 or null in you my statment.
|
|---|