my %keyval = (); while(){ ($s1,$s2) = split(/,/); $keyval{$s1} = $s2; } #### if (exists $keyval{$c5}) { $custnmbr = $keyval{$c5}; $flag = 1; }