go ahead... be a heretic | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I am guessing you want to get something like this.
The best aproach for this would be to make a hash with the food item as the key and its group number as the value stored under this key. No playing with refs there :( Perhaps you want the user to enter a food item and the program will suggest possibly combinations to go with this, in this case the best approach is probably functional programing ! I think Haskell is the popular one round here. But that is not why we're here is it, to do it in perl you may well want to build an array or hash of arrays. As your food groups are numeric in your rules I'd be inclined to use array of arrays.
If you want to do the hash of arrays you can build it up like this
Cheers,
Pereant, qui ante nos nostra dixerunt!
In reply to Re: Continuing from "Turning foreach into map?" - perlreftut and References
by Random_Walk
|
|