Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: how do i split a link

by Amoe (Friar)
on Apr 13, 2002 at 18:08 UTC ( #158818=note: print w/replies, xml ) Need Help??

in reply to how do i split a link

sub gimmelinks { my $html = shift; my @linkywinkys; use HTML::TokeParser; my $parsee = HTML::TokeParser->new(\$html); while (my $tag = $parsee->get_tag('a')) { push @linkywinkys, {url => $tag->[1]->{href}, txt => $parsee->get_trimmed_text('/a')}; } return @linkywinkys; }

That should do you fine if you want to use good old HTML::TokeParser. You get the link text free as well! It returns an array of hashes, where the url is the "url" key and the text is the "txt" key. What am I saying - figure it out yourself :)


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://158818]
[shmem]: erix, yes, it's a WTF. Since...
[erix]: antisemitic && (pro-)russian. Makes sense :P
[shmem]: erix: what's antisemitic in there? Tell me.
[erix]: AngloZionist
[shmem]: and it is *not* pro-russian. It describes the western world.
[erix]: I'm not going to read it so I could be mistaken but it reeks of useful idiocy
[shmem]: AngloZionist is not an antisemitic term.
[shmem]: erix: be assured that we all are horribly mistaken, always. What would we write tests for, if not for that fact?
[shmem]: and then, audiatur et altera pars.
[erix]: and what's the "Vineyard"? Don't tell me it's doing supernatural stuff too.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2018-03-19 20:55 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (246 votes). Check out past polls.