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

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I also tried this:
use WWW::Mechanize(); my $mech = WWW::Mechanize->new(); my $html = $mech->get('http://umallvt.com/directory.php'); my @links= $mech->find_all_links( text_regex => qr/a/i ); foreach(@links){ if($_->url() eq 'http://www.victoriassecret.com/'){ print "\n"; print "url \n"; print $_->url(); print "\n"; print " text\n"; print $_->text(); print "\n"; } } _END_

The out put is :

url: http://www.victoriassecret.com/

text: Victoria's Secret

In case the page had an anchor tag like below:

a href="http://www.victoriassecret.com/" target=_blank><img src=http://www.victoriassecret.com/nw.gif height=11 width=11 border=0 alt="Open this result in new window"> </anchor>

The above perl script would give :

url: http://www.victoriassecret.com/

text: Open this result in new window

But the desired result is:

url: http://www.victoriassecret.com/

text: IMAGE


In reply to Re^6: anchor text match by kumar801012
in thread anchor text match by kumar801012

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
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 chilling in the Monastery: (6)
As of 2021-05-17 19:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (159 votes). Check out past polls.

    Notices?