Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This should be easy, but I'm haven't stumbled upon the answer yet.
I can successfully use the tr/// operator if both search list and replacement list are hardcoded. ie.
But the following does not produce the same result:my $s =~ tr/abcd/ABCD/;
Any clarification you can provide would be greatly appreciated. Thanks.my $replace = 'ABCD'; my $s =~ tr/abcd/$replace/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: configurable tr///?
by MidLifeXis (Monsignor) on Jan 27, 2010 at 22:42 UTC | |
|
Re: configurable tr///?
by toolic (Bishop) on Jan 27, 2010 at 22:40 UTC | |
|
Re: configurable tr///?
by Anonymous Monk on Jan 27, 2010 at 22:41 UTC | |
|
Re: configurable tr///?
by umasuresh (Hermit) on Jan 27, 2010 at 23:36 UTC |