in reply to Multidimensional arrays
Also, you probably don't need to repeat the "plan" and "length" in the inner hash, you already know them as they're the keys to it (unless you need to iterate over the values somewhere).
Update: BTW, the syntax you used is not correct.my %price = ( 1 => { 1 => { name => 'Early Adopter', price => 3.49, stripe => 'price_123245', }, 6 => { name => 'Early Adopter', price => 18.99, stripe => 'price_123267', }, 12 => { name => 'Early Adopter', price => 32.49, stripe => 'price_123289', }}, 2 => { 1 => { name => 'First Increase', price => 3.99, stripe => 'price_123445', }, ...
Multidimensional syntax $price[1,1] not supported at 1.pl line 6.
The correct syntax is $price[1][1].
Similarly, the syntax for the hash of hashes will be
my $gbp_sum = $price{$plan}{$length}{price};
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Multidimensional arrays
by Bod (Parson) on Jun 06, 2023 at 15:52 UTC | |
by choroba (Cardinal) on Jun 06, 2023 at 16:00 UTC | |
by Bod (Parson) on Jun 06, 2023 at 17:12 UTC | |
by ablanke (Monsignor) on Jun 06, 2023 at 22:51 UTC | |
by hv (Prior) on Jun 06, 2023 at 16:02 UTC | |
by Bod (Parson) on Jun 06, 2023 at 17:15 UTC |