Beefy Boxes and Bandwidth Generously Provided by pair Networks BBQ
Syntactic Confectionery Delight
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Usually people fall into two categories: visual learners and oral learners. You might be in the second category, in which case it could help to find a local perl course (usually not available) or someone with perl knowledge to talk to (chances pretty good). At least if you are in or near a bigger city you should be able to find a perl user group (for example "perl mongers"). Whether you get someone to help you is dependant on your social skills ;-)

Independent from that the best way to learn any programming language is to write small programs yourself, as previous posters already mentioned. But for that one important piece of knowledge (that beginner books strangly never seem to impart) is how to debug. It is rather trivial knowledge, but most things are after you know them. And while debugging you learn the most about a language

When you write programs, even really small ones, you will produce bugs and your program will produce surprising output. If it is a syntax error it is easy, just read the error message for hints where to look. But if your program just does something strange or loops endlessly or just hangs, what do you do?

Simple, you check what your program is doing in detail by adding print statements. Statements like print "start of loop 1\n" will tell you the order in which your program is executed. Statements like print "counter is $counter\n" will tell you the contents of variables at critical points in your program. Don't assume anything, check what you believe to know

Perl can help you with debugging. Always write "use warnings;" and "use strict;" at the start of your scripts. Strict mode may seem like a hassle (basically you have to declare every variable with 'my' the first time you use it), but it is worth it in the long run.

If you further add "use Data::Dumper;" you can always print out variable values with print Dumper(\$counter); in much more detail, very helpful with arrays and hashes.


In reply to Re: Best ways of learning Perl! by jethro
in thread Best ways of learning Perl! by Tea

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (12)
    As of 2014-04-24 10:34 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (565 votes), past polls