If only it were that simple. I actually posted an incorrect version of this script, my appologies. The script that I should have posted follows: (I had placed a number of print statements through the previous post which I had used to try and find the problem)

#!/usr/bin/perl -wT use strict; use IO::Socket; use HTML::Entities; require './libraryCommon.pl'; unless (@ARGV) { die "Exiting without parameter. (HINT: You need to p +ass the ISBN)\n"; } unless (testISBN($ARGV[0])) { my $host="xml.amazon.com"; my $port=80; my $buff=""; my $line; my $title=""; my $date=""; my $manufacturer=""; my $author=""; my @author; my $count=0; my $isbn=$ARGV[0]; my $getBook="GET http://$host/onca/xml2?t=webservices-20&dev-t=D3N +1ICFCFE4DHV&AsinSearch=$isbn&type=lite&f=xml HTTP/1.0\ \n\n"; my $sock=new IO::Socket::INET(PeerAddr => $host, PeerPort => $port +, Proto => 'tcp') or die "Couldn't connect to $host"; $sock->autoflush(1); print $sock $getBook; $count=0; while (<$sock>) { decode_entities($_); if (m%<ProductName>(.*?)</ProductName>%) { $title = $1 } elsif (m%<Author>(.*?)</Author>%) { $author[$count]=$1; $count++; } elsif (m%<ReleaseDate>.*, (\d\d\d\d)</ReleaseDate>%) { $date=$ +1; } elsif (m%<Manufacturer>(.*?)<\/Manufacturer>%) { $manufacturer +=$1; } } close($sock); print $title, "\n"; foreach $author (@author) { print $author, "\n" }; print $date, "\n"; print $manufacturer, "\n"; } else { die "Exiting due to the fact that you have supplied an invalid +ISBN."; }

In reply to Re: Re: Reading an XML page by Guildencrantz
in thread Reading an XML page by Guildencrantz

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.