sub getWord { my ($word) = @_; my $content = get("http://www.dictionary.com/cgi-bin/dict.pl?term=$word"); if ($content =~ //) { my @content = '200'; my $temp; while ($content =~ //) { $content =~ s/.*?(.*?)//s; $temp = $1; while ($temp =~ /<(li|dd).*>.*<\/\1>/is) { $temp =~ s#.*?<(li|dd).*?>(.*?)##is; $_ = $2; s/(<.*?>|\&.*?\;)//sg; s/^\s+(.*)\s+$/$1/; push(@content, $_); } } return @content; } elsif ($content =~ //) { ($content) = $content =~ /(.*?)/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; } }