Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
"be consistent"
 
PerlMonks  

Comment on

( #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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (8)
    As of 2014-04-20 12:02 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (485 votes), past polls