my %lookingFor; my $ref = [1, 2, 3]; $lookingFor{qr/a.*blah/o} = $ref; $lookingFor{qr/the.*blee/o} = $ref; #Tie::RegexpHash would let you do $lookingFor{$bigfileline} #without looping over keys() at all. No idea if it's faster.