Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Seeking guidance on getting better at Perl.

by pmu (Beadle)
on Aug 17, 2013 at 13:52 UTC ( #1049835=perlquestion: print w/ replies, xml ) Need Help??
pmu has asked for the wisdom of the Perl Monks concerning the following question:

Respected Monks,

I have been dabbling with Perl once in a while. I have automated a few things at work. However, there are many a times when I feel getting more acquainted with Perl will do me good as I will be able to write better scripts. Furthermore, in current economy and job market, for a storage admin, knowing Perl really well could also be considered an added advantage. And for that, I will be really thankful if the benevolent monks could help me with the questions below.

Good Books - Any suggestions or pointers would be immensely helpful.Yes, a quick google search could reveal more, but I am looking for some books that the monks here consider worthy.

Choice of OS - All of the Management workstations we use are Windows Based. Though I have some familiarity with Linux, would it help if I learn Perl on a Linux Box? Is there any advantage in doing so? I don't think that it would matter to recruiters if I use Linux or Windows to write Perl scripts but in case it would, I would be glad if someone could point out so (or otherwise).

Foremost apologies if any questions asked here appear irrelevant. I am just trying to find ways to get really get good at Perl.

Aeterna Est Perspectum Cognitio

Comment on Seeking guidance on getting better at Perl.
Re: Seeking guidance on getting better at Perl.
by vsespb (Hermit) on Aug 17, 2013 at 14:31 UTC
    For case of Admin tasks and Web development, Perl mostly used under Linux, IMHO.
Re: Seeking guidance on getting better at Perl.
by Pickwick (Beadle) on Aug 17, 2013 at 15:06 UTC
    Good Books

    perldocs itself is a good start: http://perldoc.perl.org/index-language.html

    Though I have some familiarity with Linux, would it help if I learn Perl on a Linux Box?

    Not from my point of view, first you need to get familiar with the language, afterwards you can think of different OSes. The differences are mainly paths and especially packages, some packages are considered Linux/Posix-only, but the most important things are available in both worlds.

Re: Seeking guidance on getting better at Perl.
by toolic (Chancellor) on Aug 17, 2013 at 15:10 UTC

    Regarding books:

    • When I first started out, Learning Perl was great.
    • After getting comfortable with the basics, and I needed more, The Perl Cookbook hit the spot. It was a handy bag of tricks for common tasks with arrays, hashes, sorting, regular expressions, etc.
    • Later on, I picked up Perl Best Practices. Although it can be a lightening rod of controversy, it made me write more consistent code and to think about why I write the way I do.
Re: Seeking guidance on getting better at Perl.
by davido (Archbishop) on Aug 17, 2013 at 15:31 UTC

    • Learning Perl -- A great starting point.
    • Intermediate Perl -- Teaches you about references, packages, objects, and an intro to testing.
    • Programming Perl -- Great detail on the language, and one of the best treatments on Unicode I've seen.
    • Advanced Perl Programming -- Older book, but learn far more than everything you ever wanted to know about typeglobs, as well as intro to parsing, using templates, a brief tutorial on Perl XS and Inline::C.
    • Perl Cookbook -- Older book, but much of it is still relevant. It's helpful in learning idiomatic Perl, and "get the job done" Perl, though some of the idioms may have been superseded by now.
    • Modern Perl -- Learn how people are using Perl in the 21st Century. Intro to Moose, more on testing, modern good practices and idioms.
    • Higher Order Perl -- Never fear wielding callbacks and coderefs again. Learn how to apply functional techniques to Perl.
    • Mastering Regular Expressions -- Older book, but there's still no better resource for learning regexes inside and out.
    • Perl Best Practices -- Ok, so some of them fizzled, and some were controversial, but if you learn anything from this book, learn to think in terms of best practices (not necessarily to blindly follow the ones asserted in the book).
    • Mastering Perl -- Rounds out the Learning, Intermediate , Mastering series. Good read.
    • Programming the Perl DBI -- Older book, but IMHO, before you can hope to make good use of DBIx::Class, you should understand how DBI works, and this book will get you there.
    • Mastering Algorithms with Perl -- Older book, and some of it is not modern-day idiomatic Perl. But algorithms themselves don't change much over the years, and I still refer back to it from time to time. It was one of the most approachable algorithms books I ever read.
    • Perl Testing: A Developer's Notebook -- If you aren't writing tests, there's more to learn. :)

    This is an incomplete list. There are also the specialization books; a book on LWP, a book on XML, a book on using TT2, a book on CGI (CGI is becoming irrelevant, but understanding the mechanics of a stateless ecosystem is still good knowledge, as it's still applicable in web development). There's a good network programming book too.

    There's an Apress book by Sam Treagar on writing modules for CPAN.

    And then there are the books that aren't Perl-related, but that approach topics that Perl can be applied to. My personal opinion is there's never a shortage of topics to read up on. ;)


    Dave

Re: Seeking guidance on getting better at Perl.
by moritz (Cardinal) on Aug 17, 2013 at 17:01 UTC
    Good Books - Any suggestions or pointers would be immensely helpful

    "Mastering Regular Expressions" by Jeffrey Friedl and "Higher Order Perl" by Mark Jason Dominus (free ebook available for the latter) are the two books I would strongly recommend.

    Though I have some familiarity with Linux, would it help if I learn Perl on a Linux Box? Is there any advantage in doing so?

    There are lots of perl functions that map pretty much directly to syscalls on linux, but which are usually awkward or not implemented on windows (for example handling symlinks). See for example the sections "Input and output functions" and "Functions for filehandles, files, or directories" in perlfunc.

    If you want to learn to use those, doing it on linux would make things much easier. On the other hand if you plan to stay on windows, there's not much point.

    A very good way to become a better programmer (not just perl) is to participate in the community (for example sites like perlmonks and stackoverflow). That way you get to read some code that other people wrote, plus some suggestions on how to improve it, and some tricks for implementing things that you would never invent yourself.

    An even more direct approach would be to find somebody who reviews the code you write for work, and gives you suggestions on how to improve it.

    Foremost apologies if any questions asked here appear irrelevant.

    They aren't. Similar questions have been asked before, but right now I can't find any similar nodes.

      Hi Moritz,

      Thank you for such a detailed answer. Though all linux flavours are almost similar, which one is better suited? Any suggestions on that?

      Aeterna Est Perspectum Cognitio
        I recommend debian, because it's a good package manage tool which helps newbie to keep away from annoyance of module installation(mostly because of XS module)




        I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Re: Seeking guidance on getting better at Perl.
by mhearse (Hermit) on Aug 17, 2013 at 17:23 UTC
    Do things you have never done before. Here's some suggestions.

    • Instead of using modules from CPAN write your own
    • Write an indexer
    • Write functions/methods that manipulate 2d arrays
    • Write functions/methods that manipulate 3d arrays
    • Learn bitwise and bitshifting operators
    • Write a module which interfaces with a shared object
    • Learn curses

    Personally I'd recommend skipping writing GUIs in perl.

      • Learn curses
      Blistering barnacles! Those sure come in handy!
Re: Seeking guidance on getting better at Perl.
by pmu (Beadle) on Aug 17, 2013 at 17:46 UTC

    Hi Monks,

    Thank you very much for taking time to provide such detailed answers. This is why this site is such a great treasure trove of knowledge. :)

    Aeterna Est Perspectum Cognitio
Re: Seeking guidance on getting better at Perl.
by Endless (Beadle) on Aug 17, 2013 at 22:00 UTC

    Thanks for the good question; I've appreciated the answers as well. I have enjoyed doing much of what was mentioned above, such as going through the code/writing my own packages, and trying new things. In addition, here are my takes/recommendations on a few books:

    • Modern Perl (by chromatic) was the first one I picked up, but I found the structure of it a bit difficult for a newbie. I switched to Learning Perl and Beginning Perl to better effect. I especially recommend Beginning Perl.
    • Intermediate Perl and Programming Perl are next on my list. Programming Perl is supposed to be one of the classics, and bears Larry's name itself.
    • I haven't heard it mentioned much, but I am ABSOLUTELY impressed with "Mastering Algorithms with Perl," which is the equivalent of a data structures text book executed in Perl and has loads of hints that help to understand the guts of Perl (not to mention countless insights and code samples about referencing and doing all kinds of clandestine things with hashes, arrays, and references).

    Finally, I wish I had sooner learned to start every program with:

    use strict; use warnings; use diagnostics;

    I'm sure you've seen the first two around everywhere; the last one supplements them with verbose warnings that give you full suggestions on what the problem might be, often including working suggestion examples. Not necessary for Perl pros, but if you are like me and can get lost in obscure meanings of the brackets, parenthesis, and commas, diagnostics is a life saver.

      While the diagnostics pragma is a useful tool for debugging, particularly when you are learning Perl, I would recommend removing, or commenting out, the use diagnostics; line in production code.

      Perhaps, as a general rule-of-thumb, consider doing this at the same time that you change

      $DEBUG_MODE = 1;

      to

      $DEBUG_MODE = 0;

      and for much the same reasons.

      -- Ken

        Absolutely. Nice point; I don't know what Diagnostics does to your code performance. For my learning time, what is $DEBUG_MODE best used for?

      Hi Endelss,

      Thanks for such a detailed answer.

      Aeterna Est Perspectum Cognitio
Re: Seeking guidance on getting better at Perl.
by eyepopslikeamosquito (Canon) on Aug 17, 2013 at 22:36 UTC
Re: Seeking guidance on getting better at Perl.
by sundialsvc4 (Monsignor) on Aug 18, 2013 at 13:32 UTC

    The Perl language, itself, is comparatively small.   The best way I know of to “learn it” is to continue “automating things at work.”   Then, when $work is not giving you particular things to do, just make-up something to do, and do it.   Make something substantial, consisting of multiple modules and OOP, since that will be the most-realistic scenario.

    Learning to program a computer is like learning to swim ... books can only take you so far.

    But, with Perl, “swimming” (“DWIMming?”) is really only a small part of it, because Perl (more-so than many other languages) comes with a marina full of boats of all shapes and sizes.   Usually, when you start on a project with Perl, you do so by picking-out a handful of well tested “boats” then stitching them together with code of your own devising.   “Learning about Perl” therefore has a lot to do with “learning about CPAN.”

    Thanks to virtual-machine technology (e.g. VMWare or VirtualBox), and dirt-cheap real-big external hard drives, the Linux environment is very easy to get to now.   I”d strongly suggest familiarizing yourself with it a-n-d Windows.   Learn about Perl in both environments.

    “Learning about Perl” is an abstract target ... you can’t hit that ... make it concrete.   Make it a bunch of little concrete stepping-stones.

      e.g. write a small utility that excerpts important information from logfiles / commands and displays this info in a convenient manner. (If that is actually possible due to the GUIshness of Windows applications.)
Re: Seeking guidance on getting better at Perl.
by pmu (Beadle) on Aug 18, 2013 at 16:16 UTC

    Whoa,

    I am running out of words to thank you Monks. I guess this is why they say "PerlMonks is the best way to learn Perl". Man, you guys rock. Its amazing that so many of you take time to write a genuine response to a query. I got truckloads of suggestions on everything I asked for and some more...Generally, people scoff at questions like "which versions of Linux", but not here...Thank you very much all.

    || Aeterna Est Perspectum Cognitio ||

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1049835]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (14)
As of 2014-07-29 16:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (223 votes), past polls