Your skill will accomplish
what the force of many cannot
Trouble grepping values when hash contains multiple values per keyby dirtdog (Beadle)
|on Jun 05, 2010 at 15:35 UTC||Need Help??|
dirtdog has asked for the
wisdom of the Perl Monks concerning the following question:
Ye Wise ones, i'm struggling over here...would love ye help.
I'm going to show you an example using one file format that works followed by an example with a new file format that does not work..And due to a requirements change i need to use the one that's not working
This is an example where the grep works when i use a manually created holiday file:
In this case $hol_file contains holidays for all global exchanges..below is the file format which i manually created (small sample of it):
CA: 20100101 20100215 20100305
US: 20100101 20100528 20100101
JP: 20100305 20100527 20100322
##$cntry_of_issue is a 2 char Country Code derived For purposes of this example let's assume it's US
That worked splendidly but the global cal was too manually intensive. Now I'm receiving a new comma delimited global calendar file and am trying to do something similar to above, but the grep is not working (it's not finding the matching date).
The following example does NOT work:
$hol_file is now the new comma delimited file below (small sample of it):
978,XBRN,CH,Berne Stock Exchange,2010,20100101
978,XBRN,CH,Berne Stock Exchange,2010,20100102
978,XBRN,CH,Berne Stock Exchange,2010,20100321
978,XBRN,CH,Berne Stock Exchange,2010,20100324
##$cntry_of_issue is a 2 char Country Code derived For purposes of this example let's assume it's CH
The grep in this case does NOT find the $date. Is it because the values(holidays) of the key (country), in this case "CH", is not a true list like in the 1st example above?
ur help for a solution is very much appreciated! Thanks