Error in Perl Code : Bad switch statement(Problem in code block)? near ## line #
Hi i am facing very weired problem in oerl ...My code is having lots of switch statements which are perfectly correct by syntax...The code runs properly ..But when i have inserted printf statements in code somewhere which has nothing to do with the switch case statements i have written,still it gives the above error(in subject line)..If i remove print statements,sometimes it runs properly and sometimes not...I am not knowing what the hell is happeneing?Plz suggest some solution..
|
Maybe you could post the actual code so people could see what is going on?
|
This is part of my code
use Switch;
switch($FrameX_rand_range_value) { case 0 {$FRAME_X_cor = int(rand(1000));} case 1 {$FRAME_X_cor = 0;} case 2 {$FRAME_X_cor = $FrameX_MIN;} } printf BGND_INFO ("FRAME_X_cor = $FRAME_X_cor"); switch($FrameY_rand_range_value) { case 0 {$FRAME_Y_cor = int(rand(1000));} #case 1 {$FRAME_Y_cor = writeti::randfromrange();}//Asifs fun wil be called case 2 {$FRAME_Y_cor = $FrameY_MIN;} } #endcase printf BGND_INFO ("FRAME_Y_cor = $FRAME_Y_cor\n"); #------------------------------------------------------------------------------- #----------------------Extract everything required for background----------- my $Frame_Name =${$frameInfo->{frameRef}}[$frameIndex][0]; printf BGND_INFO ("\$Frame_Name = $Frame_Name\n"); my $Bgnd_Name =${$frameInfo->{frameRef}}[$frameIndex][1]; printf BGND_INFO ("\$Bgnd_Name = $Bgnd_Name\n"); my $Bgnd_Index =${$frameInfo->{frameRef}}[$frameIndex][2]; printf BGND_INFO ("\$Bgnd_Index = $Bgnd_Index\n"); my $Total_MBs_defined_for_frame = ${$frameInfo->{frameRef}}[$frameIndex][3]; printf BGND_INFO ("\$Total_MBs_defined_for_frame = $Total_MBs_defined_for_frame\n"); Sorry actually i cant paste full code here as its confidential...but this is how my code is...I am not getting the exact problem for the "error" |
Moved: This thread is more suitable in <PROGRAMMING> and has been moved accordingly to help your thread/question get the exposure it deserves.
|
As per this page: http://perldoc.perl.org/functions/printf.html, I think you need print, not printf. You're not using a format list.
|
All times are GMT -5. The time now is 02:33 PM. |