in reply to How to compare a field in 2 files and set a value if it matches?
First off, change that ugly split command. Instead of 36 $c variables, how about a @c array? You have to reference using the indexes so you'll have to change the numbers to one less when you update your code(since arrays index starts @ 0).
#from this: ($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11,$c12,$c13 +,$c14, +$c15,$c16,$c17,$c18,$c19,$c20,$c21,$c22,$c23,$c24,$c25,$c26,$c27,$c28 +,$c29,$c30,$c31,$c32,$c33,$c34,$c35,$c36) = split(/ /); #to this: @c=split(/ /);
As mentioned before, you can only read the <KEY> file once and the next time through you will miss records. Also, in the while(<KEY>) loop I see you setting $custnmbr you then print it, but in the print CONVERTED statement you misspell it $custnumbr. This may be part of the problem.
HTH
|
|---|