sub getWord { my ($word) = @_; my $content = get("http://www.dictionary.com/cgi-bin/dict.pl?term=$w +ord"); if ($content =~ /<!-- resultItemStart -->/) { my @content = '200'; my $temp; while ($content =~ /<!-- resultItemStart -->/) { $content =~ s/.*?<!-- resultItemStart -->(.*?)<!-- resultItemEnd + -->//s; $temp = $1; while ($temp =~ /<(li|dd).*>.*<\/\1>/is) { $temp =~ s#.*?<(li|dd).*?>(.*?)</\1>##is; $_ = $2; s/(<.*?>|\&.*?\;)//sg; s/^\s+(.*)\s+$/$1/; push(@content, $_); } } return @content; } elsif ($content =~ /<!-- resultListStart -->/) { ($content) = $content =~ /<!-- resultListStart -->(.*?)<!-- result +ListEnd -->/s; $content =~ s/<.*?>//gs; $content =~ s/^.*?Suggestions:\s+(.*?)\n\n.*$/$1/s; my @content = split(/\n/, $content); unshift(@content, '404'); return @content; } else { return undef; } }
In reply to Grab Dictionary.com Definition by mousey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |