Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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

$corresonedname=($arrone[$p]."astat.gz";
is missing the closing parenthesis. Also, at line 251:
$calfilename=&gencalfn($corresonedname,$comparison)
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. :)

In reply to Re: debug the error!! by turnstep
in thread debug the error!! by vnpandey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-24 00:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found