my @SUB_REC = map {[qr{$_->[0]}, $_->[1]]} ( ['(robert|bobby)', 'bob'] ); #### foreach (@SUB_REC) { $yourText =~ s/$_->[0]/$_->[1]/g; }