my %ciks_hash; undef @ciks_hash{@ciks}; # this is called "hash slice" # ... later: if ($form_type=~/$formget/i && exists $ciks_hash{$cik}) { ... }