open(REGEX, "<$filter"); while() { next if ($_ =~ m/^\s*#.*$/); chomp; $regex .= "$_, "; } close(REGEX); my $code = eval <( split /^/, $lines );