Don't ask to ask, just ask | |
PerlMonks |
Re: Matching Values in an Arrayby Laurent_R (Canon) |
on Nov 21, 2014 at 19:54 UTC ( [id://1108047]=note: print w/replies, xml ) | Need Help?? |
Your approach is going the wrong around (although you could still make it work). Basically, in such a case, you need to read data from Station.CSV and lookup data from Parameters.CSV. The best way to do that is to first load Parameters.CSV into memory (in a hash of hashes, I would say, but an array of hashes would also fit the bill), and, once you've done that to read sequentially Station.CSV and to the necessary hash lookups. Your data is not very large, the second file will fit into memory without any problem.
Possibly something like this (quick untested code) to populate the HoH: Retrieving the data is then quite simple in the %params HoH. No time now, but I'll try to give a complete solution in a couple of hours. Update: corrected a mistake in the code above. And below the full solution, a bit later than I originally planned: Output:
In Section
Seekers of Perl Wisdom
|
|