in reply to Patern matching html.
#!/usr/bin/perl -w use strict; use LWP::Simple; use constant URL => 'http://spanish.about.com/homework/spanish/blword. +htm'; my $today = (localtime)[3]; my $page = get(URL) or die "can't download page.\n"; # grab today's entry. my($entry) = $page =~ m/if \(day == $today\) [^\(]+\(\"([^\"\);]+)/; # remove markup. $entry =~ s/<[^>]+>//g; my($word,$def, $sentence, $trans) = $entry =~ m/([^:]+):([^\.]+\.)([^, +]+),(.*)/; print "word: $word\n"; print "definition: $def\n"; print "sentence: $sentence\n"; print "translation: $trans\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Patern matching html.
by zzspectrez (Hermit) on Nov 25, 2000 at 05:59 UTC | |
by rpc (Monk) on Nov 26, 2000 at 02:19 UTC |