LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-19-2008, 11:48 PM   #1
suyog255
LQ Newbie
 
Registered: Feb 2008
Posts: 2

Rep: Reputation: 0
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..
 
Old 02-19-2008, 11:53 PM   #2
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Maybe you could post the actual code so people could see what is going on?
 
Old 02-20-2008, 12:00 AM   #3
suyog255
LQ Newbie
 
Registered: Feb 2008
Posts: 2

Original Poster
Rep: Reputation: 0
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"
 
Old 02-20-2008, 12:25 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,974
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Moved: This thread is more suitable in <PROGRAMMING> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 02-20-2008, 05:35 PM   #5
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,261

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bad switch statement (problem in the code block?) tekmann33 Linux - Newbie 2 12-27-2006 11:53 AM
Code: Bad EIP value error nitukhatu Linux - Hardware 1 04-22-2006 01:02 AM
mandrake 10.1 on laptop error code Bad EIP thomas56 Linux - Laptop and Netbook 1 09-20-2005 08:36 PM
Bad switch statement (problem in the code block?) nifflerX Linux - General 2 07-14-2004 03:45 PM
for statement c code question dragoon linux Programming 3 12-31-2003 11:17 AM


All times are GMT -5. The time now is 07:04 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration