I have a Perl script that traverses a directory hierarchy using File::Next::files.  It will only return to the script files that end in ".avi", ".flv", ".mp3", ".mp4", and ".wmv."  Also it will skip the following sub directories:  ".svn" and any sub directory that ends in ".frames."  This is specified in the file_filter and descend_filter subroutines below.
my $iter = File::Next::files(
        { file_filter => \&file_filter, descend_filter => \&descend_filter },
        $directory );
sub file_filter { 
    # Called from File::Next:files.
    # Only select video files that end with the following extensions.
    /.(avi|flv|mp3|mp4|wmv)$/
}
sub descend_filter { 
    # Called from File::Next:files.
    # Skip subfolders that either end in ".frames" or are named the following:
    $File::Next::dir !~ /.frames$|^.svn$/
}
What I want to do is place the allowed file extensions and disallowed sub directory names in a configuration file so they can be updated on the fly.
What I want to know is how do I code the subroutines to build regex constructs based on the parameters in the configuration file?
/.(avi|flv|mp3|mp4|wmv)$/
$File::Next::dir !~ /.frames$|^.svn$/