use strict; use POSIX; use LWP::Simple; my $html = get('http://www.dictionary.com/search?q=' . shift); my ($def) = $html =~ /<!-- Content -->(.*)<!-- End content -->/s; $def =~ s/(<\/table>(?!.*<\/table>)).*$/$1/sg; print html2text($def); sub html2text { my $html = shift; my $tmp_file = tmpnam() . '.html'; open(FH,'>',$tmp_file) || die $!; print FH $html; close FH; my $text = `lynx -dump $tmp_file`; $text =~ s/References\n.*//s; unlink $tmp_file; return $text; }
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to (jeffa) Re: Grab Dictionary.com Definition
by jeffa
in thread Grab Dictionary.com Definition
by mousey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |