while (my $invoice = $sth->fetchrow_hashref) {
my $tmp = $invoice->{amazon_order_id};
$tmp =~ s/ \(\d+\)//; # get rid of (0) (1) etc at the end of the id, as we dont need it here
print qq|GOT: $invoice->{amazon_order_id} ($tmp) \n|;
if ($invoices->{$tmp}) {
print STDERR "TEST: " . ref($invoice_items->{$tmp}) . "\n";
push @{$invoice_items->{$tmp}} = {
name => $invoice->{product_name},
qty => $invoice->{quantity_shipped},
amount => $invoice->{item_price},
total => $invoice->{item_price} * $invoice->{quantity_shipped},
};
print STDERR "added.. \n";
} else {
$invoices->{$tmp} = $invoice;
push @{$invoice_items->{$tmp}}, {
name => $invoice->{product_name},
qty => $invoice->{quantity_shipped},
amount => $invoice->{item_price},
total => $invoice->{item_price} * $invoice->{quantity_shipped},
};
print Dumper($invoice_items);
}
}
####
TEST: ARRAY
Not an ARRAY reference at make.cgi line 34.
####
push @{$invoice_items->{$tmp}} = {
... vals
}