my @reg_exes = ( q|Reach Holly Smith for help by sending an email\nto hollysmith@nosuchdomain\.com\.|, q|For more information, contact Holly Smith at\nhollysmith@nosuchdomain\.com\.|, q|For more information, contact Holly Smith at \(800\) 555-1212 or\nvia email to hollysmith@nosuchdomain\.com|, ); my $new_string = 'For more information, contact Holly Smith.'; # Then, after creating a list of eligible files in a particular directory # and then opening each file to slurp its contents into $slurped file # (code not shown here)... for my $reg_ex ( @reg_exes ) { if ( $slurped_file =~ s/$reg_ex/$new_string/g ) { print "Matched one or more occurrences of reg ex '$reg_ex' and substituted '$new_string' each time\n"; } } # Then store the changed file, etc. #### my @patterns = ( q|Reach Holly Smith for help by sending an email\nto hollysmith@nosuchdomain\.com\.|, q|For more information, contact Holly Smith at\nhollysmith@nosuchdomain\.com\.|, q|For more information, contact Holly Smith at \(800\) 555-1212 or\nvia email to hollysmith@nosuchdomain\.com|, ); my @reg_exes; for my $pat ( @patterns ) { push @reg_exes, qr/$pat/; } my $new_string = 'For more information, contact Holly Smith.'; # Then, after creating a list of eligible files in a particular directory # and then opening each file to slurp its contents into $slurped file # (code not shown here)... for my $reg_ex ( @reg_exes ) { if ( $slurped_file =~ s/$reg_ex/$new_string/g ) { print "Matched one or more occurrences of reg ex '$reg_ex' and substituted '$new_string' each time\n"; } } # Then store the changed file, etc.