open REs, "< re_file" or die "can't read re_file: $!"; while () { chomp; my $mode = substr($_, 0, 1, ''); # reverse-chop push @re, [ $mode, match_maker($_) ]; } close REs; # make me a match... ;) sub match_maker { my $pat = shift; return eval qq{ sub { \$_[0] =~ $pat } }; }