Tricky has asked for the wisdom of the Perl Monks concerning the following question:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Control flow revisited
by dragonchild (Archbishop) on Sep 05, 2003 at 16:33 UTC | |
You really need to get away from the keyboard and put down on paper exactly the steps you want your code to achieve from the user's perspective. Treat your code as a black box and write down the actual specifications. Important questions you need answers to: And, that's only a subset of the questions you need to ask. Remember - you are telling a being with a 0 IQ exactly what it needs to do. Unless you explicitly tell it, it won't know to do it. If you don't check for a situation, you cannot expect it to do so. So, if you're not sure of what you want to do, you have absolutely no way of telling the computer what to do. Programming, in my mind, should be 75% design and 25% coding. Both of those tasks should be 40% doing the task and 60% verifying you did the task correctly. So, if you do the numbers, you should really be spending your time as such: Yes, design is that important. If you have it right, correct coding is a breeze. If you don't have it at all, correct coding is impossible. ------ The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6 Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified. | [reply] |
by Tricky (Sexton) on Sep 06, 2003 at 11:33 UTC | |
Cheers for the advice, dragonchild. Haven't seen the wood for the trees. So glad I visit the Monastery! I've set the guidelines down in stone (again). If I posted material to the monastery, would you folks be willing to critique? Regarding the coding problem I posted - it's now sorted! Time to get back to the drawing board... : ) | [reply] |
|
Re: Control flow revisited
by Aragorn (Curate) on Sep 05, 2003 at 13:21 UTC | |
Another way is to slurp the file into a single variable: And do the search/replace on this string, all in one go. This is left as an exercise ;-) Arjen | [reply] [d/l] [select] |
|
Re: Control flow revisited
by Abigail-II (Bishop) on Sep 05, 2003 at 12:44 UTC | |
assuming that 100 is the line you want to match. Abigail | [reply] [d/l] |
|
Why that's an error
by DentArthurDent (Monk) on Sep 05, 2003 at 15:57 UTC | |
| [reply] |