The script will output one of two things -- formatted text :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 } }
or a hashPerl 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")
In reply to ISBN lookup via Amazon by boo_radley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |