#!/usr/bin/perl use strict; use warnings; # Read the regexes my @Rexes; while (my $t=) { chomp $t; last if $t=~/^$/; my ($regex, $repl) = split /\t+/, $t; push @Rexes, [ qr($regex), $repl ]; } # Process the text while (my $l = ) { $l=~s/$$_[0]/$$_[1]/eg for @Rexes; print $l; } __DATA__ duck cluck a(b+)c c$1a That bird says "duck!" xyzzy plugh ac abc abbc abbbc