473,387 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Multiline runaway??

2
I'm getting this error on my program and don't know what's the problem?

syntax error at testing5 line 38, near "chomp($choice=<STDIN>);"
(Might be a runaway multi-line )) string starting on line 37)

Here is the code:

line34 until ($choice == q) {print "What would you like to convert?\n\n"};
line35 chomp($choice=<STDIN>);

line37 if ($choice == 1) {$choice = ($choice - 32) * 5/9;
line38 print "Converts to $choice Celsius.\n\n";}
Oct 30 '06 #1
4 6524
vssp
268 100+
I think STDN varilabel value set as NULL may be


Please chsk
vssp
Oct 30 '06 #2
miller
1,089 Expert 1GB
The flaw is simply in your logic. Line 34 displayed below is an infinite loop.
Expand|Select|Wrap|Line Numbers
  1. line34  until ($choice == q) {print "What would you like to convert?\n\n"};
  2.  
Change your code to
Expand|Select|Wrap|Line Numbers
  1. for (;;) {
  2.     print "What would you like to convert?\n\n";
  3.     chomp($choice=<STDIN>);
  4.     last if $choice eq 'q';
  5.  
  6.     ... # All your other code here
  7. }
  8.  
Oct 30 '06 #3
splatt
2
Thanks for the reply. I've tried to approach from another angle but now I'm getting syntax errors:

syntax error at testing8 line 39, near ")
do fahrenheit"
testing8 had compilation errors.


code:

print "What would you like to convert?\n\n";
chomp($choice=<STDIN>);

if ($choice eq '1')
do fahrenheit();

elsif ($choice == '2')
do gallons();

elsif ($choice == 3); {&miles;}

elsif ($choice == 4); {&yards;}

elsif ($choice == 5); {&feet;}


sub code:
sub fahrenheit{
print "Enter the number you would like to convert?\n\n";
chomp($choice=<STDIN>);
$choice = ($choice - 32) * 5/9;
print "Converts to $choice Celsius.\n\n"; }

sub gallons
{print "Enter the number you would like to convert?\n\n";
chomp($choice=<STDIN>);
$choice = $choice * 3.785;
print "Converts to $choice liters.\n\n";}

I've tried this so many ways that I can't see straight. Any guidance would be greatly appreciated.
Nov 1 '06 #4
miller
1,089 Expert 1GB
.. but now I'm getting syntax errors:

syntax error at testing8 line 39, near ")
do fahrenheit"
testing8 had compilation errors.
Just like your error reported, the code that you tried was illegal. This line needs to be changed. Simply remove the "do", as there is no reason for it to be there. Also, you should follow the same design standards that you use for all other if statements by using code blocks {}.

Expand|Select|Wrap|Line Numbers
  1. do fahrenheit();
  2.  
Nov 3 '06 #5

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

Similar topics

0
by: Rasmus Fogh | last post by:
Dear All, I need a way of writing strings or arbitrary Python code that will a) allow the strings to be read again unchanged (like repr) b) write multiline strings as multiline strings instead...
1
by: David Hane | last post by:
Hi all, I would like give users the ability to experiment with complex queries but I'm worried about them creating queries that will bog down the server. Does anyone have any ideas for...
8
by: Thomas W Ping | last post by:
Putting focus in a form element like a dropdown box and using the mouse wheel - even one click forward or backward with it - cycles through every record, in that direction, until first or last...
4
by: Matthew Groch | last post by:
Hi all, I've got a server that handles a relatively high number of concurrent transactions (on the magnitude of 1000's per second). Client applications establish socket connections with the...
7
by: Joel Finkel | last post by:
Folks, I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry. The...
40
by: Edward Elliott | last post by:
At the risk of flogging a dead horse, I'm wondering why Python doesn't have any multiline comments. One can abuse triple-quotes for that purpose, but that's obviously not what it's for and doesn't...
9
by: John Salerno | last post by:
How do you make a single string span multiple lines, but also allow yourself to indent the second (third, etc.) lines so that it lines up where you want it, without causing the newlines and tabs or...
6
by: Zdenek Maxa | last post by:
Hi all, I would like to perform regular expression replace (e.g. removing everything from within tags in a XML file) with multiple-line pattern. How can I do this? where =...
4
by: db2admin | last post by:
Hello, Sometime, clients disconnect after starting sql and sql keep running in the db2 engine making it a runaway sql. is there something in DB2 which can avoid this behavior i.e. clean any...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.