Hello Perl Monks, My usage of Perl has been light, I've never studied it. If I needed to do something I looked how to do that specific task and moved on. But I've hit a hurdle with WWW::Mechanize::Link. I have no problem with the beginning part:
my $mech = WWW::Mechanize->new(); $mech->get( $url ); my @links = $mech->links(); print Dumper (@links);
And with the Dumper I can see all the data in there, including the parts I want (i.e. specific links). What I cannot figure out how to do is to cast those arrays in @links into individual WWW::Mechanize::Link objects and loop through them. I've tried nested foreach loops, but in the end I just come up with a mess. Each new array just has more arrays, and sometimes a hash reference that I can't dereference. I figure that there must be a proper way. Any hints would be appreciated. Thank you

In reply to How to properly go through a WWW::Mechanize::Link object? by SergioQ

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!
  • 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:
    & &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.