[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[FWP] How to do variable interpolation in a tr substitution string



Dear Perl Gurus,
Why am I not able to do this as is in s/([a-z])/$h{$1}/g; etc?

The code I am trying to make work is:

srand;
    @new = ();
    @old = a .. z;
    while (@old) {
        push(@new, splice(@old, rand @old, 1));
    }
$"="";

$compstr=join("",@new);
#print $compstr;

while (<>)
{tr/a-z/$compstr/;print $_;
}

Thanks in advance. I am not sure whether it is OK to post this to this
Mailing List. My apologies if it is inappropriate. 
Mohan Chunkath

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe