I remember someone asking for an ISBN lookup for the Great Perl Booke Exchange, and came across this script. It uses Amazon's website for the service, and I acknowledge that some may feel ethically compelled to not use this script. I found that in testing it, the parse_amazon sub doesn't exactly function as advertised; some of the page's html has been altered slightly. below is a corrected version :
sub parse_amazon { my ( $text, $ashash ) = @_; return undef if $text =~ /Books search: we were unable to find exa +ct matches/i; my ( $title ) = $text =~ /^Amazon.com: buying info: (.*)$/im; my ( $pages ) = $text =~ m:(\d+) pages:; my ( $price ) = $text =~ m:<strike>\$([\d\.]+)</strike>:; my ( $publisher ) = $text =~ m:\n\s+([^;\n]+);[\s\n]+ISBN:isg; my ( $author ) = $text =~ m:\nby <a href=[^>]+>(.*?)</font>: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 => $autho +rs[1], author3 => $authors[2], pages => $pages, price => $price*$DOLLAR, publisher => $ +publisher } }
The script will output one of two things -- formatted text :
Perl 5 Pocket Reference, 3rd Edition: Programming Tools (O'Reilly Perl +) by Johan Vromans, Larry Wall, Linda Mui 96 pages, $9.95
or a hash
(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")

In reply to ISBN lookup via Amazon by boo_radley

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.