in reply to Reading from databse and writing to file.

First of all Can somebody tell me if my code is correct. second for what I want to do is this the right way. I am new to perl. Thanks for your help
  • Comment on Re: Reading from databse and writing to file.

Replies are listed 'Best First'.
Re: Re: Reading from databse and writing to file.
by graff (Chancellor) on May 15, 2003 at 01:47 UTC
    Can somebody tell me if my code is correct.

    Well, can you tell whether it's correct? If you do "perl -cw this_script.pl", does it report errors or warnings? If so, what are they? If not, it should run, so when you run it, does it do what you expect, or something else instead? (If there are run-time errors, what are they? etc)

      This is the message that it is giving me. Useless use of string gt in void context at bookkeeping.pl line 51.
        I'm guessing that line 51 is this one:
        If $ncount gt 0;
        First, "if" should not be capitalized. Next, parens will help. Thirdly, use "==" ">" rather than "gt" for numeric comparison. (I think only the first point is mandatory; Perl is probably trying to interpret "If" as some sort of function call.)

        Apart from that, try formatting for legibility -- sensible and regular indents, breaking up long lines, and so on. It really cut down on the amount of time spent fixing things.