473,786 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiline runaway??

2 New Member
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 6549
vssp
268 Contributor
I think STDN varilabel value set as NULL may be


Please chsk
vssp
Oct 30 '06 #2
miller
1,089 Recognized Expert Top Contributor
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 New Member
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 Recognized Expert Top Contributor
.. 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
1958
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 of escaping the \n's. A repr function that output triple-quoted strings with explicit (non-escaped) linebreaks would be perfect.
1
2450
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 preventing a runaway process? I'd like to empower my users AND keep my server online :-) Thanks!
8
2067
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 record is reached. MSKB has a VB workaround for making Access unresponsive to the mouse wheel, but I don't need to prevent that -- just the *runaway* cycling. Any ideas? I've not seen this behavior in any other applications. Logitech USB optical...
4
5434
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 server. Data is sent and received over these connections using the asynchronous model. The server is currently in beta testing. Sporadically over the course of the day, I'll observe the thread count on the process (via perfmon) start climbing....
7
4052
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 problem is that only the modified data from the SingleLine TextBoxes are returned. The original data are returned for the MultiLine TextBoxes. Also, if the page is sent to the server (for validation, for instance), only the modified data for the...
40
4644
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 nest properly. ML has a very elegant system for nested comments with (* and *). Using an editor to throw #s in front of every line has limitations. Your editor has to support it and you have to know how to use that feature. Not exactly...
9
3181
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 spaces to be added to the string as well? Example (pretend this is all on one line): self.DTD = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"\n"http://www.w3.org/TR/html4/strict.dtd">\n\n'
6
3802
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 = open("filename").read() multilinePattern = "^<tag.... <\/tag>$" re.search(multilinePattern, where, re.MULTILINE)
4
2562
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 agents/subagents/sqls when client is no longer connected ?
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9492
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10360
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10163
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10108
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.