
rovf
Veteran
Feb 18, 2010, 3:23 AM
Post #8 of 8
(523 views)
|
|
Re: [krmudvayne] 1st pearl problem
[In reply to]
|
Can't Post
|
|
wow.. now im so confuse. after inserting it in the first part of the code.. i run it.. it has so many error. This is exactly why I suggested doing it.
. almost all area errors.. it seems that most of my codes are wrong.. now it gets really hard.. i dont know where to start From your posting, I guess that you are not only a beginner in Perl, but also that you have never written a computer program before. If your teacher has really not shown you how to start a program, I feel sympathy with you, because from my own work with beginners, I know how hard it is. Hence a few suggestions: (1) From you programming style, you seem to write a program similar as writing a letter in a foreign language: We are not proficient in the foreign language, but we hope that as long our text is approximately right, the reader will understand us. Programming is different: Each piece of the program is either correct, or completely wrong. This means that every statement you write, must be completely understood by you, otherwise it doesn't make sense to proceed. For instance in your posting you wrote Add = 1; (which will have given raise to an error). Do you understand what it means? Can you explain it? If not, this is something you need to ask before proceeding. (2) If you get many errors - and this will happen often even after you get more experience -, and you can't see the reason of the error, cut down your code as far as possible (by commenting out parts of it). Ideally, you are left with a small piece of code, maybe only 1-2 statements, which show the error. Now try to understand the error message. Maybe you see what is wrong. If you fail to understand it, post this small piece of code, together with the error message, and ask for help. (3) Before writing actual code, write a sketch of the steps the program is supposed to do, in plain English. You can write these steps as Perl comments and leave them in the code, so they serve as documentation (and helps us seeing what you are going to do). Always be precise: Someone reading your writings, must fully understand what you want to accomplish. HTH. Ronald
|