Nobumi Iyanaga <[EMAIL PROTECTED]> wrote on 4/9/01 at 11:38 AM:

> I have a short question about the "tr" command.  Is it impossible to use 
> variables in the tr command, in this way? :

Nope, not like that.

>From perlop.pod:

    Note that because the translation table is built at compile
    time, neither the SEARCHLIST nor the REPLACEMENTLIST are
    subjected to double quote interpolation.  That means that if you
    want to use variables, you must use an eval():

        eval "tr/$oldlist/$newlist/";
        die $@ if $@;
    
        eval "tr/$oldlist/$newlist/, 1" or die $@;
        
Hope this helps,

-- 
John Gruber                                    <[EMAIL PROTECTED]>
Bare Bones Software                       <http://www.barebones.com/>

Reply via email to