Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


Search this Thread
Old 02-19-2008, 11:48 PM   #1
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
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
LQ Newbie
Registered: Feb 2008
Posts: 2

Original Poster
Rep: Reputation: 0
This is part of my code

use Switch;
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");

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;}

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
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,983
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
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,287

Rep: Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034
As per this page:, I think you need print, not printf. You're not using a format list.


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:50 PM.

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