#!/usr/bin/env perl use strict; my $s = 'eabcde'; my $t = $s; print "$t\n"; $t =~ tr/abcd/efgh/; print "$t\n"; print '*' x 4, $/; my $search = 'abcd'; my $replace = 'efgh'; $t = $s; print "$t\n"; eval { $t =~ tr/$search/$replace/; }; print "$search\n"; print "$replace\n"; print "$t\n"; #### eabcde eefghe **** eabcde abcd efgh epbade