Unreadable code,
Why would anyone use it?
Learn a better way.
Here's why I use it: Because I can write a program to summarize the winners on the web page in 5 minutes.
use WWW::Mechanize;
my $mech = WWW::Mechanize->new( autocheck => 1 );
$mech->get( "http://aspn.activestate.com/ASPN/Perl/Haiku/AboutPerl" );
my @names = ($mech->content =~/Name: (.+?)<BR/igm);
my %count;
++$count{$_} for @names;
for my $key ( sort { $count{$b}<=>$count{$a} || lc $a cmp lc $b } keys %count ) {
printf "%3d: %s\n", $count{$key}, $key;
}
tried it ... q on re's (Score:1)
thanks for the sample code. tried it. worked on cygwin (beats activestate and I dont have a *nix box online) after a bit of buggerising around with CPAN modules.
One question though - why is it better to use regex's to extract data rather than to use a html parser?
I ask this as I'm currently using re's to extract data from google and writing and debugging regex's takes up the most time.
bootload [netspace.net.au], groking softwa
Re:tried it ... q on re's (Score:2)
If you're extracting data from Google, you may want to look at the link functions in WWW::Mechanize, anyway. It does a lot of the parsing for you.
--
xoa
Another hack, a question and a patch (Score:2)
I needed to know who subscribed and unsubscribed from the Groo [groo.com] mailing-list in the old times. The online archives list every mail received by the list owner between 1995 and 1997, including subcription and unsubscription notifications.
Here's the hack:
Re:Another hack, a question and a patch (Score:2)
--
xoa