Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I think that you may have expected a ready-made solution, which is why Re^2: anchor text match surprised you. The poster there was not (I think) trying to solve your problem, but rather to indicate to you how you could solve it. (That was the meaning of the “Two clues in one” text.)

It's not surprising that the code you indicate doesn't do what you want—the for loop makes no effort to check whether the link being processed satisfies any special conditions, and so must treat every link equally.

To fix this, you must have something of the following shape in your code:

for my $link ( @links ) { if ( is_special $link ) { do_special_thing $link } else { do_ordinary_thing $link } }
* where it's up to you to determine how to write is_special and do_special_thing (you've already indicated what you want do_ordinary_thing to be). As an aid, you have the $link object to hand, and so can test its properties in as much detail as necessary.

* I don't mean literally that your code has to contain these words; just that, without some sort of conditional, you'll never get the special treatment you like.


In reply to Re^7: anchor text match by JadeNB
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 How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (8)
As of 2024-04-16 18:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found