sub parse_amazon {
my ( $text, $ashash ) = @_;
return undef if $text =~ /Books search: we were unable to find exact matches/i;
my ( $title ) = $text =~ /^Amazon.com: buying info: (.*)$/im;
my ( $pages ) = $text =~ m:(\d+) pages:;
my ( $price ) = $text =~ m:\$([\d\.]+):;
my ( $publisher ) = $text =~ m:\n\s+([^;\n]+);[\s\n]+ISBN:isg;
my ( $author ) = $text =~ m:\nby ]+>(.*?):s;
$author =~ s/<.*?>//sg; $author =~ s/\([^\)]+\)//g; chomp $author;
my @authors = split /\s*,\s*/,$author; $"=", "; chomp @authors; #"
return "$title\n by @authors\n $pages pages, \$$price\n $publisher\n" unless $ashash;
return { title => $title, author => $authors[0], author2 => $authors[1], author3 => $authors[2],
pages => $pages, price => $price*$DOLLAR, publisher => $publisher }
}