On Mon, 2002-07-08 at 14:03, 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). you can't use tr/// on $1, because that's a read-only variable, instead, try to assign the value of $1 to another variable and use tr/// on that one: ($use_tr_on_me = $1) =~ tr/iw/JX/; > > I tried a sort of nested expression similar to what you show > > $string =~ s|{(.*?)}|{$1 =~ tr/iw/JX/)}|xg; > > It's supposed to capture the text between curly brackets and then do a > transliteration (i-->J and x-->X) > > but for: kdkdkiwiwdkdkdk {iwidkwidkw} kdkdkdwiwiwkdkdk {kdkdikdkddk} > > I get: "kdkdkiwiwdkdkdk {iwidkwidkw =~ tr/iw/JX/} kdkdkdwiwiwkdkdk > {kdkdikdkddk =~ tr/iw/JX/}" that's because you are substituting (.*?) for "$1 =~ tr/iw/JX/" as a string, if you want to evaluate it as code, you need to add an e modifier to s///, (and you can get rid of the x because you aren't using it anyway): $string =~ s|{(.*?)}|($t=$1) =~ tr/iw/JX/;"{$t}"}|eg;
hope that helps :-) Marco Antonio Valenzuela Escárcega -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]