http://qs1969.pair.com?node_id=455885

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

Is it hashes, references, objects or something else?

Update:

After reading the replies, I realise that my question was not enough. What I really wanted to ask was:

What's the most useful thing to learn after covering everything in Learning Perl?

Or is it a case of learn something when it becomes apparent and always use perldoc?

Thanks,

Gavin.

Walking the road to enlightenment... I found a penguin and a camel on the way.....
Fancy a yourname@perl.me.uk? Just ask!!!

Replies are listed 'Best First'.
Re: What's the most important thing to learn in the Perl world?
by Corion (Patriarch) on May 11, 2005 at 08:09 UTC

    The most important thing is to learn to read the documentation and where to find what in the documentation.

    perldoc perltoc
      And in light of that, start off with the perlintro POD(also available in the documentation that comes with perl itself btw). That one provides enough information to commence writing basic perl programs and conveniently provides links to other more advanced PODs with in-depth detail on the various subjects in the introduction. Then again, you've been here a lot longer than I have, is it someone else you want to introduce to perl?

      Remember rule one...

      What I meant to say, was what's the next important thing to learn after you have grasped the basics.

      Sorry.

      Walking the road to enlightenment... I found a penguin and a camel on the way.....
      Fancy a yourname@perl.me.uk? Just ask!!!

        After you've learned the basics, it's time to move to the advanced stuff.

        Your question is so open ended and still so without any focus it's hard to get at what you're aiming for. I consider arrays, hashes and anonymous data structures basic knowledge.

        What I meant to say, was what's the next important thing to learn after you have grasped the basics. I recommend:
        1. perldoc perlfunc -- memorize function names, and roughly what they do
        2. perldoc -f <function> -- memorize the usage of this command. It will give you the details on a function, without having to search through perlfunc for it. This assumes you can remember the function name (see step 1).
        3. If you haven't already, read about good programming style for block structured programming (in any language). Discipline yourself in good practice. Learn how to break huge functions down into managable functions, learn to document your functions as you write them, learn to take the time to choose good variable names. Teach yourself to code for maintainability.
        4. Read books on testing, and specifically, how to write programs that are easy to test. Programs that are clearly correct are easier to maintain than programs where even the original programmer got confused about what's going on...
        5. Once you can write good programs, learn to write good perl programs. Master perl idioms, learn what they mean, and what the tradeoffs of using each one are. Learn regular expressions, how to use them, how not to use them, and when to document them (ie. always)
        6. Learn what CPAN modules are out there: this is not a static task. Learn perl XS if you like. Learn about closures, symbol table manipulations, and start filling in the corners of your perl knowledge.
        7. Learn everything. If you succeed, tell me how. :-)

        --
        AC
Re: What's the most important thing to learn in the Perl world?
by Zaxo (Archbishop) on May 11, 2005 at 08:11 UTC

    Clarity, Brevity, Language.

    After Compline,
    Zaxo

Re: What's the most important thing to learn in the Perl world?
by Aragorn (Curate) on May 11, 2005 at 09:41 UTC
Re: What's the most important thing to learn in the Perl world?
by woolfy (Chaplain) on May 11, 2005 at 09:21 UTC
    Well, cover the basics first: statements, variable types, constructs, operators, functions, file handling, regular expressions, subroutines, modules. Of course, references, hashes and objects are part of these basics.

    Next on my list of important things is general knowledge of programming. I know many people advise to learn programming in a structured way with another programming language than Perl, like C. Perl has a very easy learning curve, for starting programmers. After the basics, the learning curve becomes more steep. But still, it's possible to do this with Perl. Just keep in mind that you have to be able to read your own program after a year. Better still, imagine that you have to write a program that has to be maintained by a murderous psychopath with a big axe, who will not be happy when he cannot understand the code. When you learn programming in Perl, read many examples and books, see how things are done there. Make your code a pleasure to read, it must be a joy to see you code, and no murderous axe-man will come after you.

    As important is documenting your code. Try to be a teacher with a very difficult and rough class. It should be fun to read your documentation. After a year, you should be able to understand your own code by just reading the documentation.

    Of course, all of this goes for programming in any language.

Re: What's the most important thing to learn in the Perl world?
by Animator (Hermit) on May 11, 2005 at 08:34 UTC

    I consider hashes to be part of the basics... so that might be a good start... (if you don't know them already)

    What you do after that is up to you, as in, what do you need? if you need to use OO then references (or atleast the tutorial) and objects might be a good path

    And what about regular expressions? they are quite useful... (or atleast IMHO), do you know them? (as in the more 'advanced' stuff like, look-aheads, look-behinds, non-capturing groups (not that this is really advanced, but you should know (and use!) them aswell), ...)

    But if you ask me what the most important thing in the perl world is then I would say: `perldoc perlstyle` (or atleast the basic things of that). Coding without a decent style (like indenting things) results in useless code.

Re: What's the most important thing to learn in the Perl world?
by DrHyde (Prior) on May 11, 2005 at 09:30 UTC
    In order of preference:
    1. where to find The Fine Manual and how to use it effectively;
    2. learn that it's OK to ask stupid questions (but only ask each stupid question once);
    3. references;
    4. where to find your local Perl Mongers group;
    5. your local guru's favourite beer
Re: What's the most important thing to learn in the Perl world?
by tlm (Prior) on May 11, 2005 at 11:49 UTC

    Well, if you studied Learning Perl you should know about hashes already (it has a whole chapter on them).

    Without a doubt, the next thing on your list should be references.

    After that, the next thing I would recommend is to get a good handle on the whole Perl module/package/importation/object/class Ball O' Wax, with a bit of symbol tables thrown in. By way of exercise, collect the simplest ways to create a module, a class, a package, an object (e.g. my $o = bless +{}, 'x'; there, I just created a Perl object belonging to class x, and stuffed it in $o). This will help you sort out these various concepts, which are often presented all at once in a big gemisch.

    the lowliest monk

Re: What's the most important thing to learn in the Perl world?
by g0n (Priest) on May 11, 2005 at 08:53 UTC
    < facetious > use strict < /facetious >

    To an extent, hashes lead to references, which lead to objects. To try and give some sort of answer to your question, I found references to be a major revelation that completely changed the way I wrote perl.

    --------------------------------------------------------------

    g0n, backpropagated monk

Re: What's the most important thing to learn in the Perl world?
by arc_of_descent (Hermit) on May 11, 2005 at 13:39 UTC

    I would have to say - find real world problems to solve. Then apply your existing Perl skill set to solve them. Soon you'll realize you could do them better, or faster, or lazier. Then its time to upgrade your skill set.

    Most people are happy with reading the best of books, but if you can't apply that knowledge then it withers away.

    Give up your day job! Go find some real life threatening problems! :-)

      in my opinion: you gave the only suitable answer. Find Real World Problems (to solve). I've learned that I always buy books when I don't need them (but I do want to learn about it..), and usually I don't read them (at that time). Or, if I do read them right after I buy them, it seems I don't fully understand them, or the books seems too difficult.

      If for instance months later I get a project assigned where I need to apply for instance the knowlegde I couldn't grasp before... at the end of the project I feel immensly enlightened (of course after reading the book). Because:
      * I really understand most parts of the book I bought months ago
      * I truely feel I've evolved (because my code 'looks' better)
      * All code I wrote before the project looks yukkie ;-) (but that's just my personal experience)

      so arc_of_descent++ !

      And to all you book loving junkies: start looking for problems! first try to solve them in a way that's not too difficult for you (to understand). And after that: try to improve your script ;-)

      to ask a question is a moment of shame
      to remain ignorant is a lifelong shame

Re: What's the most important thing to learn in the Perl world?
by thcsoft (Monk) on May 11, 2005 at 08:53 UTC
    think Perl, i'd say. forget everything you once learnt from C oder C++ or stuff like that. there aren't many things on earth looking so savourless and ugly than Perl-code from people, who still think C. perlpod perlstyle might tell you what i mean. :)

    language is a virus from outer space.
      One of the more ugly things is
      Perl-code from people, who still think Clipper
Re: What's the most important thing to learn in the Perl world?
by naChoZ (Curate) on May 11, 2005 at 12:52 UTC

    brian_d_foy's node, How do you master Perl?, has some very good discussion for someone introspective on where to go from here.

    --
    naChoZ

    Where in the nursery rhyme does it say Humpty Dumpty is an egg?

      Where in the nursery rhyme does it say Humpty Dumpty is an egg?

      It doesn't :-) The notion of "Humpty Dumpty as an anthropomorphic egg was an invention of Lawrence Charles Dodson (writing under the pen name "Lewis Carrol"), in his famous book _Alice In Wonderland_.

      As for the origin of the nursery rhyme, according to the following link, the rhyme was about a fallen cannon, which could not be raised back to it's firing wall during the English civil war.

      See http://www.famousquotes.me.uk/nursery_rhymes/humpty_dumpty.htm for more information.
      --
      AC

        HUMPTY DUMPTY WAS PUSHED

Re: What's the most important thing to learn in the Perl world?
by gube (Parson) on May 11, 2005 at 08:27 UTC

    We can't segregate between three or any concepts in perl. All the things are important for each things based on the requirements. so, go through all.

    Refer perldoc

      This is a pet peeve of mine. When someone says "what's the most important thing?", the answer can't be "every thing is most important". We're being asked to prioritize by someone who's looking for an entry point. Even if it's wrong (or at least not the most correct) answer, we should give him a concrete answer.

      To answer the OPs question, I'd say that data structures are the thing that I'd consider most important. Especially nested structures (Arrays-of-Arrays, Hashes-of-Arrays, Arrays-of-Hashes, Hashes-of-Hashes, etc). Master this, and a lot of other things will become easy.

      thor

      Feel the white light, the light within
      Be your own disciple, fan the sparks of will
      For all of us waiting, your kingdom will come

        This is a pet peeve of mine. When someone says "what's the most important thing?", the answer can't be "every thing is most important". We're being asked to prioritize by someone who's looking for an entry point. Even if it's wrong (or at least not the most correct) answer, we should give him a concrete answer.

        Bravo!++ Too bad I can up-vote this only once.

        What you say is so true. Both the expert and the beginner can read a manual page and understand it, at least at the denotational level. The difference is that the expert has a perspective the beginner doesn't have; for the novice all the concepts come across as having roughly equal weight; the expert can pick out the Big Deals from the trivialities. The best thing the expert can do for the novice is to share this perspective, even if it is an imperfect, limited, one-sided perspective. It is far better than the nearly total lack of perspective the beginner has.

        One of the greatest gifts I ever received was a hand-written list of "books that matter" that a college professor gave me a few days after I asked him for it. He could have just pointed me to the library; I'm forever grateful he didn't. Reading those books had a greater impact on the rest of my life than all of college. Your perspective (i.e. that ability to prioritize that comes from experience) is truly precious; an off-hand answer like "read everything" devalues it.

        the lowliest monk

Re: What's the most important thing to learn in the Perl world?
by kwaping (Priest) on May 11, 2005 at 14:47 UTC
    A lot of this is in agreement with other posters, but I'll post anyway. Here's my list of important items once the basics are covered, in no particular order:
    • http://www.CPAN.org/
    • "perldoc perldoc"
    • Regular Expressions
    • Lists of lists
    • Object Oriented Perl programming methods
    • "perl -cw"


    Update: Added the last item in the list
Re: What's the most important thing to learn in the Perl world?
by bluto (Curate) on May 11, 2005 at 16:37 UTC
    After reading the replies, I realise that my question was not enough. What I really wanted to ask was:

    What's the most useful thing to learn after covering everything in Learning Perl?

    This question as well is not enough. :-) There is a lot of material to go through. The order that you use depends greatly on what you want to get from it. Is this your career, do you need to get up to speed ASAP? Then you'll want to buy multiple books and read perldoc, use what you learn, and repeat until you are blue in the face. Some foundational books I've used are "Programming Perl", "Perl Cookbook" and "Object Oriented Perl". I had a long programming background in other languages so reference works helped me most (i.e. I never bought "Learning Perl"). If you are newer to programming, others may have to help here. Sometimes classes can work wonders.

    If this is just a hobby on the otherhand or you are writing a few short scripts here and there, then your perferred style of learning becomes more imporant (i.e. to keep it enjoyable, and less costly).

Re: What's the most important thing to learn in the Perl world?
by exussum0 (Vicar) on May 11, 2005 at 18:00 UTC
    There's a book, by a smart guy named Sippser, on compubility theory. It's very easy to read for a theory book, in earnest. Try HopCraft and Ulman if you want a harder read.

    You know the language, now know more about languages... why they work and what they can do. It's the reason I stopped posting to node questions... it's all been done before. Unless I can prove that a computer cannot do it or do it in some tractable time, it's easy to do.

    Writing an OS, a database, a programming language, all easy. Want me to do it? Sure, I can give you /something/ given enough time, money or man power. What cannot be done or has not been done before is the next step, if you want to keep learning. It includes includes a lot of other semi-practical knowledge: compilers, operating systems, computer architecture, language theory, computibility thoery, data structures etc.. It's nothing you can't learn on the fly. The harder stuff, the real theory stuff and inventing stuff, that's a lifetime road.

    But I speak with the slant of an achedemic. I wish I thought of mp3 (storing the audible band), or some of the np-complete proofs (tetris is np-complete), or quantum mechanics. All of this Class::DBI, Rec::Descent stuff, valuable and great, but nothing that hasn't been done before.

    ----
    Give me strength for today.. I will not talk it away..
    Just for a moment.. It will burn through the clouds.. and shine down on me.

Re: What's the most important thing to learn in the Perl world?
by ghenry (Vicar) on May 11, 2005 at 13:31 UTC

    Thanks everyone. All your advice is greatly appreciated!!!

    You have confirmed my thoughts, in that references/objects are pretty much the next step to take, which will make a lot of other things fall into place.

    I'm off to buy Learning Perl Objects, References, and Modules

    Thanks again all.

    Gavin.

    Walking the road to enlightenment... I found a penguin and a camel on the way.....
    Fancy a yourname@perl.me.uk? Just ask!!!
      Damian Conway's book is still the best on this subject IMHO...
        I agree. Get comfortable with references, and then read Object Oriented Perl cover to cover. Not only will you write better code, it will also be much easier to interact with modules from CPAN.
Re: What's the most important thing to learn in the Perl world?
by DaWolf (Curate) on May 11, 2005 at 17:28 UTC
    Just my 2 cents:

    If you haven't learned strict yet this is a must. It can be very tricky for people who is used to code loosely (believe me, I know =;c).

    If you already mastered strict, then IMHO Regular Expressions are definitely the way to go. It's one of Perl's most charming features and they can do wonders.

    Regards,
Re: What's the most important thing to learn in the Perl world?
by blazar (Canon) on May 12, 2005 at 07:50 UTC