On Monday, July 8, 2002, at 02:03  PM, Kevin Pfeiffer wrote:

> bob ackerman writes:
> [...]
>> so:
>> s|{(.*?)}|$1=~ tr///|xg;
>
> I'm trying to test this myself on a string (rather than $_), but don't
> understand how to use tr/// on $1 and then place the result back into the
> string (practice only).
>
> I tried a sort of nested expression similar to what you show
>
> $string =~ s|{(.*?)}|{$1 =~ tr/iw/JX/)}|xg;
>

you are using 'tr' correctly. the substitution won't work as another reply 
to your post pointed out.
problem is that $1 can't be changed using a 'tr'.
you have to do something like this:
$string =~ s|{(.*?)}| ($a=$1)=~ tr/iw/JX/|xeg;

assign $1 to $a before doing the translit.
x flag to ignore spaces; e flag to evaluate the 'tr'; and g flag to do it 
multiple times (globally).

check the other response - he knows whereof he speaks. i be a newbot, 
meself.

pob

Reply via email to