qianyu has asked for the wisdom of the Perl Monks concerning the following question:

This is the first time i learn perl,and i found it very hard or maybe i am not so clever ,so who can tell me how can i learn it well?

Replies are listed 'Best First'.
Re: how can I learn well
by GrandFather (Saint) on Jul 07, 2009 at 02:09 UTC

    Read the documentation (perl).
    Read Tutorials.
    Ask brief questions in the Chat Box (FullPage Chat).
    Ask longer questions in Seekers of Perl Wisdom.
    Read questions others have asked in Seekers of Perl Wisdom and see what you can answer, what you understand, what you don't understand but would like to and what stimulates creative juices.
    Write lots of Perl code!

    It will help a lot to know about Data::Dumper for understanding how complicated data structures hang together. Always use strictures (use strict; use warnings;).

    And probably most importantly: think about the questions you ask, take time to format your nodes nicely (people often ignore messy questions) and take the time to understand the answers you get and read any follow up material that is suggested.

    True laziness is hard work
Re: how can I learn well
by jrsimmon (Hermit) on Jul 07, 2009 at 02:28 UTC
    Find small tasks that you can accomplish. Like any large undertaking, learning a new language is a process. Approach it as such, with both short term tasks to keep your confidence up and longer term goals that will be highly rewarding.
    1. If you are already proficient in another language, look for programs that are well suited for porting to perl.
    2. If you are a beginning programmer, search out simple beginner's tutorials and work through them until you fully understand them.
    3. Play with the language. Like web programming, check out CGI. Scraping pages more to your liking? There's WWW::Mechanize. Have uses for automating ftp/ssh/etc? Check out Net::FTP and the like.
    4. Speaking of modules, become familiar with cpan. Many wheels have already been invented there, which will save you the trouble.
    5. And then just spend time here. Pay attention to those who have been around (such as Grandfather, who gave some excellent advice already). Most of what I've learned about perl I've learned by watching, listening, helping where I can, and looking for problems that I could use perl to solve.
Re: how can I learn well
by moritz (Cardinal) on Jul 07, 2009 at 07:55 UTC
    i found it very hard or maybe i am not so clever

    Others have given great advise, so let me just add a bit of encouragement:

    If you're new to programming, it feels hard at first to everybody, because the computer does exactly what you tell it to, not what you mean.

    If you had exposure to other programming languages first, you might find some things in Perl a bit weird at first. Don't worry, when your way of thinking changes a bit, you'll find that many, many things actually make sense in some way.

    Like any subject that involves changing your way of thinking it takes a bit of time; no matter how clever someone is, he can't rewire his head in an hour. That's OK, take it slowly and bit by bit. If you're confused, the monastery is a great place to get help from more experienced programmers.

Re: how can I learn well
by toolic (Bishop) on Jul 07, 2009 at 02:36 UTC
    If you are looking for a good first book to read, I recommend Learning Perl.

      I second you in this. I started too learn perl from learning perl only. I felt it is very useful to understand what is perl. After that I read intermediate perl which is also worth reading for the starters.

      --Lakshmanan G.

      The great pleasure in my life is doing what people say you cannot do.

Re: how can I learn well
by ELISHEVA (Prior) on Jul 07, 2009 at 05:31 UTC

    Inside our heads we all have a picture of the way things work, that is, a "mental model". Often something is "hard" because our mental model is not quite right. We read and read something and it just doesn't make sense because we have assumed something we should not assume. Work on becoming conscious of your expectations about how things work and challenge them by:

    • following all of the advice above
    • writing small programs to test your understanding (even 1 or 2 lines!)

    Writing small test programs will be hard at first, but don't let that stop you. Your coding fluency and your understanding will improve with each program you write.

    Best, beth

Re: how can I learn well
by missingthepoint (Friar) on Jul 07, 2009 at 07:43 UTC

    First, welcome to the Monastery :)

    May I ask how you're trying to learn? There are good ways and bad ways (and terrible ways, hopefully we can steer you clear of those).

    I agree with ELISHEVA's advice: write lots of small, simple programs, that each demonstrate one particular fact about how Perl works. Experiment. In this way you can "ask questions" about how Perl works. For instance:

    my $a = 'perl'; my $b = '$a is good'; my $c = "$a is good"; print "a=$a\n"; print "b=$b\n"; print "c=$c\n";

    Running this program is equivalent to asking "do variables interpolate in 1) single-quoted strings ($b) and 2) double-quoted strings ($c)?" (By interpolate, I mean, are the variables replaced by their values, or do you just see the variable's name.) Running this will give you the answer.

    If you can give us more information on how you're going about learning, we can probably help. :)

    The zeroeth step in writing a module is to make sure that there isn't already a decent one in CPAN. (-- Pod::Simple::Subclassing)
Re: how can I learn well
by Anonymous Monk on Jul 07, 2009 at 06:18 UTC
Re: how can I learn well
by pemungkah (Priest) on Jul 08, 2009 at 03:36 UTC
    If I may share a story from Aaron Hillegass - it's about Objective-C and Cocoa, but it's applicable:

    Remember that some things really are hard to learn! One of his managers had a doctorate in astrophysics from Caltech; when he hit something that was hard and made him feel as if maybe he wasn't smart, he said to himself, "Wait, I have a doctorate in astrophysics from Caltech. I'm not stupid - this is hard."

    Everyone hits stuff that is hard in the process of learning something new - there are a lot of new things in Perl, and some of them will seem more difficult to understand than others.

    Make sure you get enough sleep - you really need 10 hours a night when you're working hard to learn something new (and coffee != sleep). You are clever enough; it just takes time to learn.

Re: how can I learn well
by artist (Parson) on Jul 07, 2009 at 15:08 UTC
    You are not so clever, so remember to learn from scratch such as 'Learning Perl' book. Follow your learning methodology. Also remember to note down what you have learn that you can refer back. Write down whatever you have figured out how to do certain things in Perl. Ask questions here, when you do not understand something. Slowly but surely you will learn Perl.
A reply falls below the community's threshold of quality. You may see it by logging in.