# substitute in your dept codes, and a better hash name :) my %deptCodesICareAbout=( RSRCH => 1, SALES => 1 ); # substitute in the right FILE, field list, and delimiter... while() { my ($code, #whateverelse )=split/,/; if($deptCodesICareAbout{$code}) { # business logic } }