use strict; use POSIX; use LWP::Simple; my $html = get('http://www.dictionary.com/search?q=' . shift); my ($def) = $html =~ /(.*)/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; }