@res = qw/index.cgi/; # could be more than one file... @ext = qw/css tmp class edf/; $regex = ''; # note: "$", not "@" #### perl -e '$_ = "hi"; print "ok\n" if ( /|x/ ); #### $string = "initial value"; for ( @addons ) { $string .= " $_"; # or whatever } #### my $ext_regex = '\.(' . join('|', qw/css tmp class edf/) . ')$'; for ( @filenames ) { print "this one matches: $_\n" if ( /$ext_regex/i ); }