Hello there, this is my first program in Perl and i have to say i find it a much simpler language than previous ones i have encountered(i.e java, prolog).
My problem has to do with hooks. I am using the WWW:Robot module which acts like a web robot. Information on the module can be found at http://search.cpan.org/dist/WWW-Robot/lib/WWW/Robot.pm. I am writing some code of my own on top of this. When it goes through a web page it extracts its HTML content. Eventually i would want the content to go in a text file. My problem now is that i can't understand how to store the content in a string. The code from the WWW::Robot doc is:
sub invoke_contents {
my($webcrawler, $hook, $url, $response, $structure) = @_;
I have the "Programming Perl" book and i have also looked around different tutorials but i can't understand how @_ works. Does it make something like:
$webcrawler = @_;
$hook=@_;
.
.
.
$structure=@_;
as in to store everything in the hook on its own?
I wrote "our $contents = $structure;" in this sub so that to make the $structure variable global and be ale to use it outside the sub so as to store the content in an HTML file. Any idea if i could do what i want to do in a better way or any way that would work? Help is greatly appreciated.
20050718 Edit by ysth: code tags
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, details, 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, summary, 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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.