#this is what the config file will look like... #string to replace, replacement fred, john paul, pete smelly, feet #!/usr/bin/perl -w # here is some code (untested) use strict; my $config="substit.cfg"; my $regex; # setup our regexen open CONF, $config or die "cant open config $!\n"; while () { next if /^#/; # ignore comments next if /^\s*$/; # and empties chomp; my ($replace, $with)=split /,\s*/; $regex.="s/".$replace."/".$with."/;"; } close CONF; # apply them to the input stream while (<>) { eval $regex; print; }