Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

debug the error!!

by vnpandey (Scribe)
on Jun 20, 2000 at 13:17 UTC ( #18958=perlquestion: print w/replies, xml ) Need Help??

vnpandey has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: debug the error!!
by turnstep (Parson) on Jun 20, 2000 at 15:34 UTC

    The short answer is that you have a bunch of syntax errors, simple things like closing parenthesis, misplaced quotes, etc. In particular, line 123

    is missing the closing parenthesis. Also, at line 251:
    does not have a semi-colon at the end - this is what was causing the start of the errors you reported.

    This is (at least) the second time you have posted to this site without properly formatting the code. Expect your post to be voted down heavily. There are still many other errors in your post after the two mentioned above. (A hint: check for balanced parens). I could write A LOT about the problems in your code, but you would do yourself a large favor by following a few guidelines:

    • Develop a consistent coding format, especially in regards to indenting. Indent two lines (or whatever you like, just be consistent) at the start of every block (i.e. after an opening '{' ) and add or remove indentation at the start and end of every block. This will really help to catch your syntax errors.
      $example="this_is"; if ($start_a_block) { print "Indent by two spaces\n"; print "And keep indenting until the blopck is done\n"; } for $x (@every_block) { print "Indenting goes in 2 spaces every time\n"; if ($another block) { print "Notice we are now inside two blocks, "; print "and have indented twice\n"; } print "Still inside the 'for' loop, so indent is 2\n"; }
    • Use a good editor (such as emacs (which is available on Windows as well!)) that can help you to balance parenthesis and curly braces automatically.
    • Look at other people's code (on this site, or, even better in a book like Learning Perl or Effective Perl Programming) which can show you a "better" way to do things. That way, you can learn why the following example lines, which still compile and are technically correct, could all be written better
      $hour=<STDIN>;chop($hour); for($n=0;$n<=10;$n++) {chop($calibnamenew);} for($c3=0;$c3<=$c2;$c3=$c3++)
      Since I listed them, I suppose it's only fair to show the better way as well:
      chop($hour=<STDIN>); for $n (0..10) { chop($calibnamenew); for ($c3=0; $c3<=$c2; $c3++) {
    • Don't use perl monks to help you solve syntax problems: try really hard to figure those out yourselves. I understand that your previous two problems might have been a little tricky to track down, but there are things you can do (besides wrapping your code in CODE tags) that will make it easier for us to track down the bug. Try commenting out parts of the code to narrow down the error. Try doing the same thing other ways and in other places. If the line reporting the problems looks correct (as it was in this case) start going backwards line by line, looking for simple things like a missing quote or a misplaced semi-colon.
    • Don't give up! That is a rather large program that you are attempting. It looks like you have a C background - train yourself to think in perl, not C (your 'for' loops gave you away) Clean up and format your code. When it runs without errors, run it with a -w. Then add 'use strict' to let perl *really* start digging for problems. Have patience and debug carefully. Study other people's scripts. Learn about the many ways of doing it. Eventually you will develop your own style. Study the online perldocs, especially in regards to the functions. Often times they include not just a description of what the function does, but good examples as well. Don't worry about getting flames on the site. Your post was badly formatted, but at least you asked a perl-related question, which is more than we can say about some of the posts here. :)
Re: debug the error!!
by toadi (Chaplain) on Jun 20, 2000 at 13:34 UTC
    Wow Obfuscated Code ...
    My opinions may have changed,
    but not the fact that I am right

by Nitsuj (Hermit) on Aug 02, 2000 at 21:49 UTC
    This is some kind of joke, meant to be humorous, right?
    Or is this some kind of contest, the first guy to cut and paste it into a text editor and run some formatting on it and find the error wins.
    I rethought my post. I hope that I didn't sound cruel or something. I am sure that you are plenty smart and stuff, it just struck me as funny.

    Just Another Perl Hacker
Re: debug the error!!
by t0mas (Priest) on Jun 20, 2000 at 14:47 UTC
    Kind of hard to read your code ;) but I think a ; is missing after
    but it's hard to tell. Try the code tags as le suggests.

    /brother t0mas
RE: debug the error!!
by le (Friar) on Jun 20, 2000 at 13:22 UTC
    Please: put your code into <CODE> tags. I really can't read what you put here. (See the Site HowTo.)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://18958]
Approved by root
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2023-12-06 19:49 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (31 votes). Check out past polls.