Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^5: Compare Arrays, Return Valuesby broomduster (Priest) |
on Aug 28, 2008 at 15:38 UTC ( [id://707521]=note: print w/replies, xml ) | Need Help?? |
minor update: I forgot to give the necessary admonition about strict and warnings, but I see that dwm042 has covered that below.
Here's some code that does basically what apl is suggesting (in the spirit of getting you started, but leaving some things for you to do to enhance the learning experience):
There is still a lot of work that you need to do with this. For example, to make it easy on myself, I take sample data from arrays, not files (you will need to fix that part). I also took some shortcuts by (1) always ignoring ProductName, (2) always assuming that the relevant ProductID exists as a key in the hash (this really needs to be checked at the point where I use $prod_id{$num} above). As I said, this is not offered as a complete solution, rather as something to get you started.
In Section
Seekers of Perl Wisdom
|
|