Why do you have *? in "(.*?) # store non-greedy match in $1" ?
It seems like you would just need (.*) . . . what am I missing? Tim Booher [EMAIL PROTECTED] 850.244.4680 -----Original Message----- From: John W. Krahn [mailto:[EMAIL PROTECTED]] Sent: Monday, July 08, 2002 12:18 AM To: [EMAIL PROTECTED] Subject: Re: real beginner's question David Carpenter wrote: > > This is a list for beginners, right? So perhaps no one will be too annoyed > if I ask what is probably a really stupid question . . . > > I have a text file with occasional strings enclosed in braces: > kdkdkiwiwdkdkdk {iwidkwidkw} kdkdkdwiwiwkdkdk . . . > > I would like to use tr/// to modify the characters within the braces, while > leaving the rest of the file unchanged. Whlie I'm sure this is a staight > forward procedure, I've tried a number of loops and can't get it to work. > If anyone could point a beginner in the right direction, he'd appreciate it. Something like this for example: while ( <FILE> ) { s[ { # match beginning brace (.*?) # store non-greedy match in $1 } # match ending brace ][ ( $a = $1 ) =~ # can't modify $1 tr/a-zA-Z/n-za-mN-ZA-M/; # do rot13 on match $a # use the results in substitution ]xe; # x for whitespace and comments # e to run the tr/// } # end of while loop John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]