in reply to How to compare a field in 2 files and set a value if it matches?
In the DATA loop, look up $c5 in the hash:my %keyval = (); while(<KEY>){ ($s1,$s2) = split(/,/); $keyval{$s1} = $s2; }
Also, you might want to split into an array instead of using such repetitive variable names.if (exists $keyval{$c5}) { $custnmbr = $keyval{$c5}; $flag = 1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to compare a field in 2 files and set a value if it matches?
by aschroh (Novice) on May 20, 2003 at 23:34 UTC | |
|
Re: Re: How to compare a field in 2 files and set a value if it matches?
by Anonymous Monk on Jul 17, 2003 at 09:25 UTC |