ultranerds has asked for the wisdom of the Perl Monks concerning the following question:
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 th +e 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_s +hipped}, }; 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->{quanti +ty_shipped}, }; print Dumper($invoice_items); } }
TEST: ARRAY Not an ARRAY reference at make.cgi line 34.
push @{$invoice_items->{$tmp}} = { ... vals }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Not an ARRAY reference, even though it is?
by neilwatson (Priest) on Aug 25, 2015 at 16:09 UTC | |
by ultranerds (Hermit) on Aug 25, 2015 at 17:07 UTC | |
|
Re: Not an ARRAY reference, even though it is?
by 1nickt (Canon) on Aug 25, 2015 at 16:11 UTC | |
by ultranerds (Hermit) on Aug 25, 2015 at 17:09 UTC | |
|
Re: Not an ARRAY reference, even though it is?
by stevieb (Canon) on Aug 25, 2015 at 15:32 UTC |