I think the nested file reads are getting in your way. First you read a line from DATA, then you read all of KEY, a line at a time. Then you read another line from DATA. Since you've already read all of KEY, you can't read anymore. Only the keys matching the first line in DATA will be processed.
Seems to me that a better approach is to read all of DATA into an array of hashes, then loop through KEY, but I'm fuzzy on what you're trying to accomplish.
Oh, and you've just reinvented arrays the hard way. Consider this instead:
while(<DATA>) { my @c = split / /, $_; # ... }
In reply to Re: How to compare a field in 2 files and set a value if it matches?
by chromatic
in thread How to compare a field in 2 files and set a value if it matches?
by aschroh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |