in reply to line by line match on an array of strings

You can use Regexp::Assemble to build an optimized re that matches all your typedefs:
use Regexp::Assemble; my $re = Regexp::Assemble->new->add(@typedefs)->re ... if ($line =~ $re) { # do something }