in reply to Re^2: doing tr/// on-the-fly?
in thread doing tr/// on-the-fly?
...does give me the expected results:#!/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";
Why the difference?eabcde eefghe **** eabcde abcd efgh eefghe
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: doing tr/// on-the-fly?
by jwkrahn (Abbot) on Mar 18, 2010 at 01:43 UTC |