|Pathologically Eclectic Rubbish Lister|
Re: What Worked In My 1st Year Of Perl: LOLby Anonymous Monk
|on Mar 18, 2012 at 04:31 UTC||Need Help??|
I've been learning perl for 4 years now. What got me into perl was his 7th point, have a clear list of goals.
Just over 4 years ago I was at a job interview and they asked if I new perl, and I didn't. I didn't get the job due to funding, but I came out of the interview with a clear goal: to better myself, and become more marketable, Learn Perl.
I can agree to most of the advice in this thread. The below 7 points have helped me learn and program in Perl:
1) Make a new script to test new code, or concept, and name it appropriately.
It is a lot easier to manipulate a small script to understand the concept.
2) Read documentation, and not just one source.
Look at their examples and ask why they did it that way.
3) Document your code. You will come back to it one day and use it as a reference. Anytime you do something strange, use a new function, modification, or break your own style rules, document it. Your documentation should answer the question
"What have you done and why is this?"
Don't forget, your documentation should be written not only for the programmer that maintains your script, but user that runs the script. Also use white space in your code & documentation to make it easy to read.
4) Pseudocode. I make a distinction between documentation and Pseudocode. For larger programs you should write pseudocode, which describes the purpose of the program, and how it accomplishes the task. Program flow. And write pseudocode for subroutines.
5) "Check every parameter, test every assumption." This can never be stressed enough.
6) Learn regex's
7) learn to use the inline perl debugger: perl -d program_name.pl
This will help you with more complex scripts, or if you are trying to learn a new function, or just don't understand why the script isn't doing what you expect.
I have just recently been using the debugger, and have found it extremely helpful.
I am quite shocked that nobody has mentioned this one, especially considering how powerful a tool it is to learn perl.
hope it helps