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. :)
| [reply] [d/l] [select] |
Wow Obfuscated Code ...
-- My opinions may have changed,
but not the fact that I am right
| [reply] |
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 | [reply] |
Kind of hard to read your code ;) but I think a ; is missing after
$calfilename=&gencalfn($corresonedname,$comparison)
but it's hard to tell. Try the code tags as le suggests.
/brother t0mas
| [reply] [d/l] |
Please: put your code into <CODE> tags. I really can't read what you put here. (See the Site HowTo.) | [reply] |