Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

    What's my password?
    Create A New User
    [ambrus]: marto: no, not that way. if you just want to test for an existing id attribute, then write *[@id] , or you can match a regexp to the value of that attribute like *[@id=~/something/ ]
    [marto]: ambrus, thanks I ended up going with '//*[starts- with(@id, "thread_")]...
    [ambrus]: Sometimes it's easier to just match elements in ways other than xpath, like directly with perl code.
    [marto]: this is a cheap hack, a script that doesn't need to run for long, using WWW::Mechanize:: Firefox to drive some awful interface.
    [marto]: if it were anything more serious I'd spend more time looking into it properly :P

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (10)
    As of 2016-12-08 10:56 GMT
    Find Nodes?
      Voting Booth?
      On a regular basis, I'm most likely to spy upon:

      Results (140 votes). Check out past polls.