in reply to Need help on part of homework
You need to expand your %grocerytotals hash. It needs to be a HoH. i.e.
That way you can update the value for the quantity key and the total key when they add a new item. Does this make some sense?my %grocerytotals( 'Eggs' => {quantity => 0, total => 0});
edit or you could just implement the price key in that HoH as well and keep all the datatucked in a %grocery hash.
Then you can just compute the total via the printout, unless you want to store it.. in which case you would just add the total key back to the hashmy %grocery = ('Eggs' = > {quantity => 3, price => 1.45});
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Need help on part of homework
by gitarwmn (Beadle) on Nov 06, 2004 at 00:06 UTC |