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

Monks, I need your all knowing perl wisdom. I am trying to figure out the look_down function. So far I haven't been able to find any good tutorials on the look_down function, but would like to learn more about it so I can easily pull information from tables out of text or html files.

Here is what I understand about the TreeBuilder Function, please correct me in any areas that I am wrong:

use HTML::TreeBuilder; This calls the "submodule" from the perl library for use in our code.

$myobject = HTML::TreeBuilder->new; Creates a new object for the treebuilder to build upon. This may sound dumb, can someone please explain what an "object" is? Also, what does this "->" tell the computer program to do?

$myobject->parse_file($my-file-to-pull-info-from); This fills the tree with the content based on html tags?

@a-new-array = $myobject->look_down(....); And this is the main area of confusion for me. I don't know how to tell the look_down function what to look for when searching tables, or how to locate specific information. An indepth look at the look_down function would be very helpful and greatly appreciated! Also, if I messed up any of the other items in my description of how to use HTML::TreeBuilder, please feel free to correct my mistakes.

Thanks for any help!

Replies are listed 'Best First'.
Re: HTML::TreeBuilder - Look_Down Function
by Tanktalus (Canon) on Dec 23, 2008 at 05:17 UTC

    Generally, your questions aren't about HTML::TreeBuilder so much as they are about basic perl. So, the first question is: what is your technical background? Are you experienced with other programming languages (HTML is not a programming language, it's a mark-up language, though JavaScript/EMCAScript is a programming language)? If so, which one(s)? The reason this is helpful in helping you is so that we know how much depth is needed in describing the concepts, or if there are parallels between Perl and any language(s) you already know which may help solidify the difference in syntax.

    Conversely, if you don't know any languages, then we can describe it differently, and point out different resources that are more targetted to the new programmer.

    From your question, I can't tell how much background you might have in programming, so I'm afraid that if I started to explain anything, it might either gloss over stuff and confuse you more, or it could be talking down to you about things you already know. Either way, perlintro might be helpful, though, so I'd suggest starting there.

      I have zero experience in programming. I'm really only familiar with html/php/mysql things. Hope that helps!
Re: HTML::TreeBuilder - Look_Down Function
by wfsp (Abbot) on Dec 23, 2008 at 07:41 UTC
Re: HTML::TreeBuilder - Look_Down Function
by toolic (Bishop) on Dec 23, 2008 at 13:57 UTC