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 } } #### Perl 5 Pocket Reference, 3rd Edition: Programming Tools (O'Reilly Perl) by Johan Vromans, Larry Wall, Linda Mui 96 pages, $9.95 #### (title => "Perl 5 Pocket Reference, 3rd Edition: Programming Tools", author1=> "Johan Vromans", author2=> "Larry Wall", author3=> "Linda Mui", pages => 96, price => "$9.95", publisher => "O'Reilly Perl")