Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

RE: PerlMonks Newest 10 Nodes Grabber

by kryten (Scribe)
on May 04, 2000 at 22:04 UTC ( [id://10248]=note: print w/replies, xml ) Need Help??


in reply to PerlMonks Newest 10 Nodes Grabber

Nice Snippet, I really should get into LWP::Simple. One thing I noticed though.
(reverse sort {$a <=> $b }keys %node)[0..9]
Can be achived without the explicit reverse just by changing the order of $a and $b in the sort subroutine.
(sort {$b <=> $a }keys %node)[0..9]
Sorry to be pedantic, it was bugging me :)

Replies are listed 'Best First'.
RE: RE: PerlMonks Newest 10 Nodes Grabber
by httptech (Chaplain) on May 05, 2000 at 00:10 UTC
    Yeah, but we can throw most of that snippet out the window now, as Vroom has told me about http://perlmonks.org/headlines.rdf

    So here is the rewritten snippet. (Note that it now retrieves 12 headlines instead of 10. Or how many ever Vroom decides to put into headlines.rdf)

    use LWP::Simple; $/ = undef; my $slurp = get("http://www.perlmonks.org/headlines.rdf"); push @node, [$1,$2] while $slurp =~ /<item>\s*<title\s*>([^<]*)<\/title>\s*<link\s*>([^< +]*)/gio; print map { "<a href=\"$_->[1]\">$_->[0]</a>\n" } @node;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://10248]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-25 09:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found