My problem is the same as posted at
However, although the post was very helpfull I still can't pull my data.
So far the perl code I've got is
The
shows
What print line would print the AmazonOrderID value for the first customer?
Thanks for any help, I'm getting confused with what's a hash and what's an array and it's hurting my head![[ponder] [ponder] [ponder]](/data/assets/smilies/ponder.gif)
However, although the post was very helpfull I still can't pull my data.
So far the perl code I've got is
Code:
#!/usr/bin/perl -w
# include package
use CGI::Carp qw( fatalsToBrowser );
use CGI':standard';
use XML::Simple;
use Data::Dumper;
print "Content-type: text/html\n\n";
$FILENAME = "orders.xml";
my $ref = XMLin($FILENAME, ForceArray => 1);
print Dumper($ref);
print "<br><br><br><br>";
print "$ref->{'xmlns:xsi'}<br>";
$key = 0;
print $doc->{Message}{$key}->{'MessageID'}[0]->{AmazonOrderID}[0];
print "<br>Done";
The
Code:
print Dumper($ref);
Code:
$VAR1 = { 'xmlns:xsi' => '[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance',[/URL] 'Message' => [ { 'MessageID' => [ '1' ], 'OrderReport' => [ { 'FulfillmentData' => [ { 'FulfillmentMethod' => [ 'Ship' ], 'Address' => [ { 'PostalCode' => [ 'cr0 0hx' ], 'StateOrRegion' => [ 'surrey' ], 'PhoneNumber' => [ '07793533558' ], 'AddressFieldOne' => [ '97 godric cres' ], 'City' => [ 'croydon' ], 'Name' => [ 'karen webber' ], 'CountryCode' => [ 'GB' ] } ], 'FulfillmentServiceLevel' => [ 'Standard' ] } ], 'OrderDate' => [ '2007-12-15T08:03:26-08:00' ], 'AmazonOrderID' => [ '203-4034021-8454761' ], 'Item' => [ { 'ItemPrice' => [ { 'Component' => [ { 'Amount' => [ { 'currency' => 'GBP', 'content' => '29.99' } ], 'Type' => [ 'Principal' ] }, { 'Amount' => [ { 'currency' => 'GBP', 'content' => '3.95' } ], 'Type' => [ 'Shipping' ] }, { 'Amount' => [ { 'currency' => 'GBP', 'content' => '0.00' } ], 'Type' => [ 'Tax' ] }, { 'Amount' => [ { 'currency' => 'GBP', 'content' => '0.00' } ], 'Type' => [ 'ShippingTax' ] } ] } ], 'ProductTaxCode' => [ 'PTC_PRODUCT_TAXABLE_A' ], 'AmazonOrderItemCode' => [ '40393989474939' ], 'ItemFees' => [ { 'Fee' => [ { 'Amount' => [ { 'currency' => 'GBP', 'content' => '-5.09' } ], 'Type' => [ 'Commission' ] } ] } ], 'Quantity' => [ '1' ], 'Title' => [ 'Barcelona Home Shirt 2007/08 L 43"/109cm' ], 'SKU' => [ '237741-655/L' ] } ], 'AmazonSessionID' => [ '203-4034021-8454761' ], 'OrderPostedDate' => [ '2007-12-15T08:03:26-08:00' ], 'BillingData' => [ { 'BuyerPhoneNumber' => [ '07793533558' ], 'BuyerEmailAddress' => [ 'karenwwebber1@yahoo.co.uk' ], 'Address' => [ { 'PostalCode' => [ 'cr0 0hx' ], 'StateOrRegion' => [ 'surrey' ], 'PhoneNumber' => [ '07793533558' ], 'AddressFieldOne' => [ '97 godric cres' ], 'City' => [ 'croydon' ], 'Name' => [ 'karen webber' ], 'CountryCode' => [ 'GB' ] } ], 'BuyerName' => [ 'karen webber' ] } ] } ] }, { 'MessageID' => [ '2' ], 'OrderReport' => [ { 'FulfillmentData' => [ { 'FulfillmentMethod' => [ 'Ship' ], 'Address' => [ { 'PostalCode' => [ 'G31 3NN' ], 'StateOrRegion' => [ 'Lanarkshire' ], 'PhoneNumber' => [ '07923448560' ], 'AddressFieldOne' => [ 'Flat 1/2, 404 Cumbernauld Road' ], 'City' => [ 'Glasgow' ], 'Name' => [ 'Tegan Howard' ], 'CountryCode' => [ 'GB' ] } ], 'FulfillmentServiceLevel' => [ 'Expedited' ] } ], 'OrderDate' => [ '2007-12-15T06:26:08-08:00' ], 'AmazonOrderID' => [ '026-0242159-5849124' ], 'Item' => [ { 'ItemPrice' => [ { 'Component' => [ { 'Amount' => [ { 'currency' => 'GBP', 'content' => '39.99' } ], 'Type' => [ 'Principal' ] }, { 'Amount' => [ { 'currency' => 'GBP', 'content' => '5.95' } ], 'Type' => [ 'Shipping' ] }, { 'Amount' => [ { 'currency' => 'GBP', 'content' => '0.00' } ], 'Type' => [ 'Tax' ] }, { 'Amount' => [ { 'currency' => 'GBP', 'content' => '0.00' } ], 'Type' => [ 'ShippingTax' ] } ] } ], 'ProductTaxCode' => [ 'PTC_PRODUCT_TAXABLE_A' ], 'AmazonOrderItemCode' => [ '17142556682403' ], 'ItemFees' => [ { 'Fee' => [ { 'Amount' => [ { 'currency' => 'GBP', 'content' => '-6.89' } ], 'Type' => [ 'Commission' ] } ] } ], 'Quantity' => [ '1' ], 'Title' => [ 'Manchester United Away Shirt 2007/08 XXL 48"/127cm' ], 'SKU' => [ '238347-010/XXL' ] } ], 'AmazonSessionID' => [ '026-0242159-5849124' ], 'OrderPostedDate' => [ '2007-12-15T06:26:08-08:00' ], 'BillingData' => [ { 'BuyerPhoneNumber' => [ '07923448560' ], 'BuyerEmailAddress' => [ 'tevalegan@yahoo.com' ], 'Address' => [ { 'PostalCode' => [ 'G31 3NN' ], 'StateOrRegion' => [ 'Lanarkshire' ], 'PhoneNumber' => [ '07923448560' ], 'AddressFieldOne' => [ 'Flat 1/2, 404 Cumbernauld Road' ], 'City' => [ 'Glasgow' ], 'Name' => [ 'Tegan Howard' ], 'CountryCode' => [ 'GB' ] } ], 'BuyerName' => [ 'Tegan Howard' ] } ] } ] }, { 'MessageID' => [ '3' ], 'OrderReport' => [ { 'FulfillmentData' => [ { 'FulfillmentMethod' => [ 'Ship' ], 'Address' => [ { 'PostalCode' => [ 'BS21 6US' ], 'StateOrRegion' => [ 'Somerset' ], 'PhoneNumber' => [ '01275875744' ], 'City' => [ 'Clevedon' ], 'AddressFieldOne' => [ 'Channel View Farm' ], 'AddressFieldTwo' => [ 'Kingston Seymour' ], 'Name' => [ 'Mrs. K. E. Stuckey' ], 'CountryCode' => [ 'GB' ] } ], 'FulfillmentServiceLevel' => [ 'Expedited' ] } ], 'OrderDate' => [ '2007-12-15T08:08:53-08:00' ], 'AmazonOrderID' => [ '203-1302512-5552320' ], 'Item' => [ { 'ItemPrice' => [ { 'Component' => [ { 'Amount' => [ { 'currency' => 'GBP', 'content' => '49.99' } ], 'Type' => [ 'Principal' ] }, { 'Amount' => [ { 'currency' => 'GBP', 'content' => '5.95' } ], 'Type' => [ 'Shipping' ] }, { 'Amount' => [ { 'currency' => 'GBP', 'content' => '0.00' } ], 'Type' => [ 'Tax' ] }, { 'Amount' => [ { 'currency' => 'GBP', 'content' => '0.00' } ], 'Type' => [ 'ShippingTax' ] } ] } ], 'ProductTaxCode' => [ 'PTC_PRODUCT_TAXABLE_A' ], 'AmazonOrderItemCode' => [ '33456627889267' ], 'ItemFees' => [ { 'Fee' => [ { 'Amount' => [ { 'currency' => 'GBP', 'content' => '-8.39' } ], 'Type' => [ 'Commission' ] } ] } ], 'Quantity' => [ '1' ], 'Title' => [ 'England Supporters Home Rugby Shirt 2007/09 XXL 48"/127cm' ], 'SKU' => [ '234517-100/XXL' ] } ], 'AmazonSessionID' => [ '203-1302512-5552320' ], 'OrderPostedDate' => [ '2007-12-15T08:08:53-08:00' ], 'BillingData' => [ { 'BuyerPhoneNumber' => [ '07971 780408' ], 'BuyerEmailAddress' => [ 'stuckey@onetel.com' ], 'Address' => [ { 'PostalCode' => [ 'bs21 6us' ], 'StateOrRegion' => [ 'somerset' ], 'PhoneNumber' => [ '07971 780408' ], 'City' => [ 'kingston seymour' ], 'AddressFieldOne' => [ 'channel view farm' ], 'AddressFieldTwo' => [ 'middle lane' ], 'Name' => [ 'Mrs. K. Stuckey' ], 'CountryCode' => [ 'GB' ] } ], 'BuyerName' => [ 'Mrs. K. Stuckey' ] } ] } ] }, { 'MessageID' => [ '4' ], 'OrderReport' => [ { 'FulfillmentData' => [ { 'FulfillmentMethod' => [ 'Ship' ], 'Address' => [ { 'PostalCode' => [ 'ME17 1QW' ], 'StateOrRegion' => [ 'Kent' ], 'PhoneNumber' => [ '01622 858545' ], 'City' => [ 'Harrietsham' ], 'AddressFieldOne' => [ 'CET Safehouse' ], 'AddressFieldTwo' => [ 'Northdown House' ], 'Name' => [ 'Samantha Horton' ], 'CountryCode' => [ 'GB' ] } ], 'FulfillmentServiceLevel' => [ 'Standard' ] } ], 'OrderDate' => [ '2007-12-15T08:14:11-08:00' ], 'AmazonOrderID' => [ '202-2060132-2253123' ], 'Item' => [ { 'ItemPrice' => [ { 'Component' => [ { 'Amount' => [ { 'currency' => 'GBP', 'content' => '19.99' } ], 'Type' => [ 'Principal' ] }, { 'Amount' => [ { 'currency' => 'GBP', 'content' => '2.63' } ], 'Type' => [ 'Shipping' ] }, { 'Amount' => [ { 'currency' => 'GBP', 'content' => '0.00' } ], 'Type' => [ 'Tax' ] }, { 'Amount' => [ { 'currency' => 'GBP', 'content' => '0.00' } ], 'Type' => [ 'ShippingTax' ] } ] } ], 'ProductTaxCode' => [ 'PTC_PRODUCT_TAXABLE_A' ], 'AmazonOrderItemCode' => [ '13193953510651' ], 'ItemFees' => [ { 'Fee' => [ { 'Amount' => [ { 'currency' => 'GBP', 'content' => '-3.39' } ], 'Type' => [ 'Commission' ] } ] } ], 'Quantity' => [ '1' ], 'Title' => [ 'Manchester United Woven Shorts with Brief Black M 32/34" waist' ], 'SKU' => [ '242677-010/32-34' ] }, { 'ItemPrice' => [ { 'Component' => [ { 'Amount' => [ { 'currency' => 'GBP', 'content' => '9.99' } ], 'Type' => [ 'Principal' ] }, { 'Amount' => [ { 'currency' => 'GBP', 'content' => '1.32' } ], 'Type' => [ 'Shipping' ] }, { 'Amount' => [ { 'currency' => 'GBP', 'content' => '0.00' } ], 'Type' => [ 'Tax' ] }, { 'Amount' => [ { 'currency' => 'GBP', 'content' => '0.00' } ], 'Type' => [ 'ShippingTax' ] } ] } ], 'ProductTaxCode' => [ 'PTC_PRODUCT_TAXABLE_A' ], 'AmazonOrderItemCode' => [ '47666133453459' ], 'ItemFees' => [ { 'Fee' => [ { 'Amount' => [ { 'currency' => 'GBP', 'content' => '-1.70' } ], 'Type' => [ 'Commission' ] } ] } ], 'Quantity' => [ '1' ], 'Title' => [ 'Manchester United Home/Away Socks 2007/08 L 7.5-12 UK Foot' ], 'SKU' => [ '237955-010/L7/12' ] } ], 'AmazonSessionID' => [ '202-2060132-2253123' ], 'OrderPostedDate' => [ '2007-12-15T08:14:11-08:00' ], 'BillingData' => [ { 'BuyerPhoneNumber' => [ '01634 272422' ], 'BuyerEmailAddress' => [ 'shorton150884@hotmail.co.uk' ], 'Address' => [ { 'PostalCode' => [ 'ME3 0BB' ], 'StateOrRegion' => [ 'Kent' ], 'PhoneNumber' => [ '01634 272422' ], 'City' => [ 'Rochester' ], 'AddressFieldOne' => [ '14 West Lane' ], 'AddressFieldTwo' => [ 'Isle Of Grain' ], 'Name' => [ 'Samantha Horton' ], 'CountryCode' => [ 'GB' ] } ], 'BuyerName' => [ 'Samantha Horton' ] } ] } ] } ], 'MessageType' => [ 'OrderReport' ], 'Header' => [ { 'MerchantIdentifier' => [ 'M_KITBAG_214004' ], 'DocumentVersion' => [ '1.01' ] } ], 'xsi:noNamespaceSchemaLocation' => 'amzn-envelope.xsd' };
What print line would print the AmazonOrderID value for the first customer?
Thanks for any help, I'm getting confused with what's a hash and what's an array and it's hurting my head
![[ponder] [ponder] [ponder]](/data/assets/smilies/ponder.gif)