foreach (@typedefs){ if ($line=~ /$_/) { # perform various actions here if line match } }